diff --git a/pkg/tools/shell.go b/pkg/tools/shell.go index 85bdcb8c..873d4fcb 100644 --- a/pkg/tools/shell.go +++ b/pkg/tools/shell.go @@ -569,7 +569,7 @@ func (t *ExecTool) runBackground(ctx context.Context, command, cwd string, ptyEn // with synchronous exec runs. if err := isolation.Start(cmd); err != nil { if session.ptyMaster != nil { - session.ptyMaster.Close() + _ = session.ptyMaster.Close() } return ErrorResult(fmt.Sprintf("failed to start command: %v", err)) } @@ -698,7 +698,7 @@ func (t *ExecTool) runBackground(ctx context.Context, command, cwd string, ptyEn // All pipes closed, get exit status if stdinWriter != nil { - stdinWriter.Close() + _ = stdinWriter.Close() } cmd.Wait() diff --git a/pkg/updater/updater.go b/pkg/updater/updater.go index f8fc29fd..b50740ac 100644 --- a/pkg/updater/updater.go +++ b/pkg/updater/updater.go @@ -576,16 +576,16 @@ func extractZip(archivePath, destDir string) error { } out, err := os.OpenFile(target, os.O_CREATE|os.O_TRUNC|os.O_WRONLY, f.FileInfo().Mode()) if err != nil { - rc.Close() + _ = rc.Close() return err } if _, err := io.Copy(out, rc); err != nil { - rc.Close() - out.Close() + _ = rc.Close() + _ = out.Close() return err } if err := rc.Close(); err != nil { - out.Close() + _ = out.Close() return fmt.Errorf("close zip entry reader: %w", err) } if err := out.Close(); err != nil { diff --git a/pkg/utils/http_retry.go b/pkg/utils/http_retry.go index 514f9781..678404f2 100644 --- a/pkg/utils/http_retry.go +++ b/pkg/utils/http_retry.go @@ -26,7 +26,7 @@ func DoRequestWithRetry(client *http.Client, req *http.Request) (*http.Response, for i := range maxRetries { if i > 0 && resp != nil { - resp.Body.Close() + _ = resp.Body.Close() } resp, err = client.Do(req) @@ -42,7 +42,7 @@ func DoRequestWithRetry(client *http.Client, req *http.Request) (*http.Response, if i < maxRetries-1 { if err = sleepWithCtx(req.Context(), retryDelayForAttempt(resp, i)); err != nil { if resp != nil { - resp.Body.Close() + _ = resp.Body.Close() } return nil, fmt.Errorf("failed to sleep: %w", err) } diff --git a/pkg/utils/media.go b/pkg/utils/media.go index e52c7e13..51d4b81e 100644 --- a/pkg/utils/media.go +++ b/pkg/utils/media.go @@ -176,7 +176,7 @@ func DownloadFile(urlStr, filename string, opts DownloadOptions) string { } if _, err := io.Copy(out, resp.Body); err != nil { - out.Close() + _ = out.Close() os.Remove(localPath) logger.ErrorCF(opts.LoggerPrefix, "Failed to write file", map[string]any{ "error": err.Error(),