Skip to content

Commit f03e7b8

Browse files
fix: lint
1 parent 4e43959 commit f03e7b8

1 file changed

Lines changed: 9 additions & 9 deletions

File tree

cmd/upgrade/upgrade.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ func runUpgrade() error {
116116
spinner.Fail("Download failed")
117117
return fmt.Errorf("could not download update: %w", err)
118118
}
119-
defer os.Remove(tmp)
119+
defer os.Remove(tmp) //nolint:errcheck
120120

121121
spinner.UpdateText("Verifying checksum...")
122122

@@ -167,7 +167,7 @@ func fetchLatestRelease() (*githubRelease, error) {
167167
if err != nil {
168168
return nil, err
169169
}
170-
defer resp.Body.Close()
170+
defer resp.Body.Close() //nolint:errcheck
171171

172172
if resp.StatusCode != http.StatusOK {
173173
return nil, fmt.Errorf("GitHub API returned %d", resp.StatusCode)
@@ -218,7 +218,7 @@ func downloadToTemp(rawURL string) (string, error) {
218218
if err != nil {
219219
return "", err
220220
}
221-
defer resp.Body.Close()
221+
defer resp.Body.Close() //nolint:errcheck
222222

223223
if resp.StatusCode != http.StatusOK {
224224
return "", fmt.Errorf("download returned %d", resp.StatusCode)
@@ -228,10 +228,10 @@ func downloadToTemp(rawURL string) (string, error) {
228228
if err != nil {
229229
return "", err
230230
}
231-
defer tmp.Close()
231+
defer tmp.Close() //nolint:errcheck
232232

233233
if _, err := io.Copy(tmp, io.LimitReader(resp.Body, maxBinarySize)); err != nil {
234-
os.Remove(tmp.Name())
234+
_ = os.Remove(tmp.Name())
235235
return "", err
236236
}
237237

@@ -251,7 +251,7 @@ func fetchChecksum(rawURL string) (string, error) {
251251
if err != nil {
252252
return "", err
253253
}
254-
defer resp.Body.Close()
254+
defer resp.Body.Close() //nolint:errcheck
255255

256256
if resp.StatusCode != http.StatusOK {
257257
return "", fmt.Errorf("checksum download returned %d", resp.StatusCode)
@@ -271,11 +271,11 @@ func fetchChecksum(rawURL string) (string, error) {
271271
}
272272

273273
func verifyChecksum(path, expected string) error {
274-
f, err := os.Open(path)
274+
f, err := os.Open(path) //nolint:gosec // path comes from os.CreateTemp, not user input
275275
if err != nil {
276276
return fmt.Errorf("could not open downloaded file: %w", err)
277277
}
278-
defer f.Close()
278+
defer f.Close() //nolint:errcheck
279279

280280
h := sha256.New()
281281
if _, err := io.Copy(h, f); err != nil {
@@ -290,7 +290,7 @@ func verifyChecksum(path, expected string) error {
290290
}
291291

292292
func replaceExecutable(dst, src string) error {
293-
if err := os.Chmod(src, 0o755); err != nil {
293+
if err := os.Chmod(src, 0o755); err != nil { //nolint:gosec // executable binary requires 0755
294294
return err
295295
}
296296

0 commit comments

Comments
 (0)