fix: resolve errcheck lint issues

This commit is contained in:
user
2026-02-20 03:17:50 -08:00
parent 3d968a1102
commit dd5e9e61ab
3 changed files with 8 additions and 7 deletions

View File

@@ -56,7 +56,7 @@ func (c *Client) do(method, path string, body any) ([]byte, error) {
if err != nil { if err != nil {
return nil, fmt.Errorf("http: %w", err) return nil, fmt.Errorf("http: %w", err)
} }
defer resp.Body.Close() defer func() { _ = resp.Body.Close() }()
data, err := io.ReadAll(resp.Body) data, err := io.ReadAll(resp.Body)
if err != nil { if err != nil {
@@ -141,7 +141,8 @@ func (c *Client) PollMessages(afterID string, timeout int) ([]Message, error) {
if err != nil { if err != nil {
return nil, err return nil, err
} }
defer resp.Body.Close()
defer func() { _ = resp.Body.Close() }()
data, err := io.ReadAll(resp.Body) data, err := io.ReadAll(resp.Body)
if err != nil { if err != nil {

View File

@@ -440,7 +440,7 @@ func (a *App) cmdWindow(args string) {
} }
n := 0 n := 0
fmt.Sscanf(args, "%d", &n) _, _ = fmt.Sscanf(args, "%d", &n)
a.ui.SwitchBuffer(n) a.ui.SwitchBuffer(n)
a.mu.Lock() a.mu.Lock()

View File

@@ -131,7 +131,7 @@ func (ui *UI) AddLine(bufferName string, line string) {
// If viewing this buffer, append to display. // If viewing this buffer, append to display.
if ui.buffers[ui.currentBuffer] == buf { if ui.buffers[ui.currentBuffer] == buf {
fmt.Fprintln(ui.messages, line) _, _ = fmt.Fprintln(ui.messages, line)
} }
}) })
} }
@@ -156,7 +156,7 @@ func (ui *UI) SwitchBuffer(n int) {
ui.messages.Clear() ui.messages.Clear()
for _, line := range buf.Lines { for _, line := range buf.Lines {
fmt.Fprintln(ui.messages, line) _, _ = fmt.Fprintln(ui.messages, line)
} }
ui.messages.ScrollToEnd() ui.messages.ScrollToEnd()
@@ -181,7 +181,7 @@ func (ui *UI) SwitchToBuffer(name string) {
ui.messages.Clear() ui.messages.Clear()
for _, line := range buf.Lines { for _, line := range buf.Lines {
fmt.Fprintln(ui.messages, line) _, _ = fmt.Fprintln(ui.messages, line)
} }
ui.messages.ScrollToEnd() ui.messages.ScrollToEnd()
@@ -218,7 +218,7 @@ func (ui *UI) refreshStatusWith(nick, target, connStatus string) {
bufInfo := fmt.Sprintf("[%d:%s]", ui.currentBuffer, ui.buffers[ui.currentBuffer].Name) bufInfo := fmt.Sprintf("[%d:%s]", ui.currentBuffer, ui.buffers[ui.currentBuffer].Name)
ui.statusBar.Clear() ui.statusBar.Clear()
fmt.Fprintf(ui.statusBar, " [%s] %s %s %s%s", _, _ = fmt.Fprintf(ui.statusBar, " [%s] %s %s %s%s",
connStatus, nick, bufInfo, target, unread) connStatus, nick, bufInfo, target, unread)
} }