Commit 8b74ccb
committed
go: more lints from CI
The lints complaining in this round are:
```
2026-03-06T04:21:47.7008261Z ##[error]mantle/auth/aliyun.go:54:15: Error return value of `f.Close` is not checked (errcheck)
2026-03-06T04:21:47.7009550Z defer f.Close()
2026-03-06T04:21:47.7009814Z ^
2026-03-06T04:21:47.7010577Z ##[error]mantle/auth/azure.go:57:15: Error return value of `f.Close` is not checked (errcheck)
2026-03-06T04:21:47.7011392Z defer f.Close()
2026-03-06T04:21:47.7011629Z ^
2026-03-06T04:21:47.7012252Z ##[error]mantle/auth/do.go:50:15: Error return value of `f.Close` is not checked (errcheck)
2026-03-06T04:21:47.7013042Z defer f.Close()
2026-03-06T04:21:47.7013280Z ^
2026-03-06T04:21:47.7014039Z ##[error]mantle/cmd/kola/devshell.go:91:19: Error return value of `agent.Close` is not checked (errcheck)
2026-03-06T04:21:47.7015642Z defer agent.Close()
2026-03-06T04:21:47.7016019Z ^
2026-03-06T04:21:47.7017184Z ##[error]mantle/cmd/kola/kola.go:450:15: Error return value of `fmt.Fprintln` is not checked (errcheck)
2026-03-06T04:21:47.7018928Z fmt.Fprintln(w, "Test Name\tPlatforms\tArchitectures\tDistributions\tTags")
2026-03-06T04:21:47.7019618Z ^
2026-03-06T04:21:47.7020686Z ##[error]mantle/cmd/kola/kola.go:451:15: Error return value of `fmt.Fprintln` is not checked (errcheck)
2026-03-06T04:21:47.7022217Z fmt.Fprintln(w, "\t")
2026-03-06T04:21:47.7022620Z ^
2026-03-06T04:21:47.7024606Z ##[error]mantle/cmd/kolet/kolet.go:271:22: Error return value of `systemdjournal.Print` is not checked (errcheck)
2026-03-06T04:21:47.7026580Z systemdjournal.Print(systemdjournal.PriInfo, "Processing reboot request")
2026-03-06T04:21:47.7027357Z ^
2026-03-06T04:21:47.7028590Z ##[error]mantle/cmd/kolet/kolet.go:280:22: Error return value of `systemdjournal.Print` is not checked (errcheck)
2026-03-06T04:21:47.7030549Z systemdjournal.Print(systemdjournal.PriInfo, "Acknowledged reboot request with mark: %s", buf)
2026-03-06T04:21:47.7031485Z ^
2026-03-06T04:21:47.7032719Z ##[error]mantle/cmd/kolet/kolet.go:300:22: Error return value of `systemdjournal.Print` is not checked (errcheck)
2026-03-06T04:21:47.7034843Z systemdjournal.Print(systemdjournal.PriInfo, "Processing soft-reboot request")
2026-03-06T04:21:47.7035647Z ^
2026-03-06T04:21:47.7036809Z ##[error]mantle/cmd/kolet/kolet.go:348:28: Error return value of `rebootReader.Close` is not checked (errcheck)
2026-03-06T04:21:47.7038368Z defer rebootReader.Close()
2026-03-06T04:21:47.7038994Z ^
2026-03-06T04:21:47.7040272Z ##[error]mantle/cmd/kolet/kolet.go:367:32: Error return value of `softRebootReader.Close` is not checked (errcheck)
2026-03-06T04:21:47.7041932Z defer softRebootReader.Close()
2026-03-06T04:21:47.7042584Z ^
2026-03-06T04:21:47.7043917Z ##[error]mantle/cmd/ore/aws/delete-image.go:67:16: Error return value of `fmt.Fprintf` is not checked (errcheck)
2026-03-06T04:21:47.7046123Z fmt.Fprintf(os.Stdout, "No valid snapshot found for %s.\n", amiID)
2026-03-06T04:21:47.7046539Z ^
2026-03-06T04:21:47.7047503Z ##[error]mantle/cmd/ore/gcloud/upload.go:249:18: Error return value of `file.Close` is not checked (errcheck)
2026-03-06T04:21:47.7048702Z defer file.Close()
2026-03-06T04:21:47.7048966Z ^
2026-03-06T04:21:47.7049770Z ##[error]mantle/cmd/ore/ibmcloud/ibmcloud.go:96:19: Error return value of `file.Close` is not checked (errcheck)
2026-03-06T04:21:47.7050762Z defer file.Close()
2026-03-06T04:21:47.7051036Z ^
2026-03-06T04:21:47.7051819Z ##[error]mantle/cmd/plume/release.go:180:25: Error return value of `releaseFile.Close` is not checked (errcheck)
2026-03-06T04:21:47.7052749Z defer releaseFile.Close()
2026-03-06T04:21:47.7053066Z ^
2026-03-06T04:21:47.7053774Z ##[error]mantle/harness/harness.go:601:14: Error return value of `fmt.Fprintf` is not checked (errcheck)
2026-03-06T04:21:47.7055077Z fmt.Fprintf(root.w, "=== RUN %s\n", t.name)
2026-03-06T04:21:47.7055402Z ^
2026-03-06T04:21:47.7056242Z ##[error]mantle/kola/cluster/cluster.go:114:16: Error return value of `in.Close` is not checked (errcheck)
2026-03-06T04:21:47.7057157Z defer in.Close()
2026-03-06T04:21:47.7057405Z ^
2026-03-06T04:21:47.7058035Z ##[error]mantle/kola/harness.go:1510:16: Error return value of `in.Close` is not checked (errcheck)
2026-03-06T04:21:47.7058904Z defer in.Close()
2026-03-06T04:21:47.7059142Z ^
2026-03-06T04:21:47.7059761Z ##[error]mantle/kola/harness.go:1973:18: Error return value of `in.Close` is not checked (errcheck)
2026-03-06T04:21:47.7060681Z defer in.Close()
2026-03-06T04:21:47.7060931Z ^
2026-03-06T04:21:47.7061563Z ##[error]mantle/kola/harness.go:2069:13: Error return value of `os.Remove` is not checked (errcheck)
2026-03-06T04:21:47.7062463Z os.Remove(tempLinkPath)
2026-03-06T04:21:47.7062725Z ^
2026-03-06T04:21:47.7063582Z ##[error]mantle/kola/tests/crio/crio.go:234:24: Error return value of `tmpFilePod.Close` is not checked (errcheck)
2026-03-06T04:21:47.7064775Z defer tmpFilePod.Close()
2026-03-06T04:21:47.7065103Z ^
2026-03-06T04:21:47.7065939Z ##[error]mantle/kola/tests/crio/crio.go:245:30: Error return value of `tmpFileContainer.Close` is not checked (errcheck)
2026-03-06T04:21:47.7066927Z defer tmpFileContainer.Close()
2026-03-06T04:21:47.7067296Z ^
2026-03-06T04:21:47.7068371Z ##[error]mantle/kola/tests/ignition/security.go:133:25: Error return value of `caserver.Listener.Close` is not checked (errcheck)
2026-03-06T04:21:47.7069387Z caserver.Listener.Close()
2026-03-06T04:21:47.7069706Z ^
2026-03-06T04:21:47.7070501Z ##[error]mantle/kola/tests/rhcos/upgrade.go:113:13: Error return value of `os.Remove` is not checked (errcheck)
2026-03-06T04:21:47.7071438Z os.Remove(tempTar)
2026-03-06T04:21:47.7071676Z ^
2026-03-06T04:21:47.7072377Z ##[error]mantle/kola/tests/rhcos/upgrade.go:281:20: Error return value of `r.Body.Close` is not checked (errcheck)
2026-03-06T04:21:47.7073307Z defer r.Body.Close()
2026-03-06T04:21:47.7073570Z ^
2026-03-06T04:21:47.7074475Z ##[error]mantle/lang/bufpipe/pipe_test.go:272:10: Error return value of `w.Close` is not checked (errcheck)
2026-03-06T04:21:47.7075500Z w.Close()
2026-03-06T04:21:47.7075703Z ^
2026-03-06T04:21:47.7076371Z ##[error]mantle/lang/bufpipe/pipe_test.go:292:10: Error return value of `w.Close` is not checked (errcheck)
2026-03-06T04:21:47.7077263Z w.Close()
2026-03-06T04:21:47.7077465Z ^
2026-03-06T04:21:47.7078092Z ##[error]mantle/lang/bufpipe/pipe_test.go:315:10: Error return value of `w.Close` is not checked (errcheck)
2026-03-06T04:21:47.7078975Z w.Close()
2026-03-06T04:21:47.7079178Z ^
2026-03-06T04:21:47.7079920Z ##[error]mantle/network/journal/record.go:78:15: Error return value of `client.Close` is not checked (errcheck)
2026-03-06T04:21:47.7080823Z client.Close()
2026-03-06T04:21:47.7081051Z ^
2026-03-06T04:21:47.7081809Z ##[error]mantle/network/mockssh/mockssh_test.go:97:20: Error return value of `client.Close` is not checked (errcheck)
2026-03-06T04:21:47.7082745Z defer client.Close()
2026-03-06T04:21:47.7083173Z ^
2026-03-06T04:21:47.7083897Z ##[error]mantle/network/mockssh/mockssh_test.go:127:20: Error return value of `client.Close` is not checked (errcheck)
2026-03-06T04:21:47.7085327Z defer client.Close()
2026-03-06T04:21:47.7085609Z ^
2026-03-06T04:21:47.7086525Z ##[error]mantle/platform/api/azure/api.go:60:11: Error return value of `os.Setenv` is not checked (errcheck)
2026-03-06T04:21:47.7087505Z os.Setenv("AZURE_CLIENT_ID", azCreds.ClientID)
2026-03-06T04:21:47.7087821Z ^
2026-03-06T04:21:47.7088488Z ##[error]mantle/platform/api/azure/api.go:61:11: Error return value of `os.Setenv` is not checked (errcheck)
2026-03-06T04:21:47.7089453Z os.Setenv("AZURE_TENANT_ID", azCreds.TenantID)
2026-03-06T04:21:47.7089765Z ^
2026-03-06T04:21:47.7090404Z ##[error]mantle/platform/api/azure/api.go:62:11: Error return value of `os.Setenv` is not checked (errcheck)
2026-03-06T04:21:47.7091367Z os.Setenv("AZURE_CLIENT_SECRET", azCreds.ClientSecret)
2026-03-06T04:21:47.7091701Z ^
2026-03-06T04:21:47.7092405Z ##[error]mantle/platform/api/esx/archive.go:46:15: Error return value of `r.Close` is not checked (errcheck)
2026-03-06T04:21:47.7093301Z defer r.Close()
2026-03-06T04:21:47.7093534Z ^
2026-03-06T04:21:47.7094181Z ##[error]mantle/platform/api/esx/archive.go:60:15: Error return value of `r.Close` is not checked (errcheck)
2026-03-06T04:21:47.7095445Z defer r.Close()
2026-03-06T04:21:47.7095681Z ^
2026-03-06T04:21:47.7096494Z ##[error]mantle/platform/api/openstack/api.go:580:18: Error return value of `data.Close` is not checked (errcheck)
2026-03-06T04:21:47.7097426Z defer data.Close()
2026-03-06T04:21:47.7097677Z ^
2026-03-06T04:21:47.7098454Z ##[error]mantle/platform/local/configdrive.go:31:15: Error return value of `os.RemoveAll` is not checked (errcheck)
2026-03-06T04:21:47.7099408Z os.RemoveAll(drivePath)
2026-03-06T04:21:47.7099795Z ^
2026-03-06T04:21:47.7100517Z ##[error]mantle/platform/local/configdrive.go:36:15: Error return value of `os.RemoveAll` is not checked (errcheck)
2026-03-06T04:21:47.7101465Z os.RemoveAll(drivePath)
2026-03-06T04:21:47.7101724Z ^
2026-03-06T04:21:47.7102548Z ##[error]mantle/platform/local/dnsmasq.go:186:12: Error return value of `cfg.Close` is not checked (errcheck)
2026-03-06T04:21:47.7103462Z cfg.Close()
2026-03-06T04:21:47.7103681Z ^
2026-03-06T04:21:47.7104575Z ##[error]mantle/platform/local/dnsmasq.go:201:12: Error return value of `cfg.Close` is not checked (errcheck)
2026-03-06T04:21:47.7105502Z cfg.Close()
2026-03-06T04:21:47.7105718Z ^
2026-03-06T04:21:47.7106389Z ##[error]mantle/platform/local/dnsmasq.go:205:11: Error return value of `cfg.Close` is not checked (errcheck)
2026-03-06T04:21:47.7107276Z cfg.Close()
2026-03-06T04:21:47.7107520Z ^
2026-03-06T04:21:47.7108376Z ##[error]mantle/platform/local/flight.go:50:17: Error return value of `nshandle.Close` is not checked (errcheck)
2026-03-06T04:21:47.7109866Z nshandle.Close()
2026-03-06T04:21:47.7110124Z ^
2026-03-06T04:21:47.7110996Z ##[error]mantle/platform/local/tap.go:79:12: Error return value of `dev.Close` is not checked (errcheck)
2026-03-06T04:21:47.7111965Z dev.Close()
2026-03-06T04:21:47.7112203Z ^
2026-03-06T04:21:47.7112904Z ##[error]mantle/platform/platform.go:317:21: Error return value of `session.Close` is not checked (errcheck)
2026-03-06T04:21:47.7113813Z defer session.Close()
2026-03-06T04:21:47.7114095Z ^
2026-03-06T04:21:47.7115033Z ##[error]mantle/platform/platform.go:349:21: Error return value of `session.Close` is not checked (errcheck)
2026-03-06T04:21:47.7115969Z defer session.Close()
2026-03-06T04:21:47.7116245Z ^
2026-03-06T04:21:47.7116890Z ##[error]mantle/platform/qemu.go:1292:13: Error return value of `os.Remove` is not checked (errcheck)
2026-03-06T04:21:47.7117796Z os.Remove(disk.dstFileName)
2026-03-06T04:21:47.7118238Z ^
2026-03-06T04:21:47.7118898Z ##[error]mantle/platform/qemu.go:1514:22: Error return value of `varsSrc.Close` is not checked (errcheck)
2026-03-06T04:21:47.7119802Z defer varsSrc.Close()
2026-03-06T04:21:47.7120089Z ^
2026-03-06T04:21:47.7120760Z ##[error]mantle/platform/qemu.go:2171:15: Error return value of `os.RemoveAll` is not checked (errcheck)
2026-03-06T04:21:47.7121667Z os.RemoveAll(builder.tempdir)
2026-03-06T04:21:47.7121955Z ^
2026-03-06T04:21:47.7122593Z ##[error]mantle/platform/util.go:64:21: Error return value of `session.Close` is not checked (errcheck)
2026-03-06T04:21:47.7123475Z defer session.Close()
2026-03-06T04:21:47.7123759Z ^
2026-03-06T04:21:47.7124556Z ##[error]mantle/harness/timeout_test.go:125:5: QF1001: could apply De Morgan's law (staticcheck)
2026-03-06T04:21:47.7125563Z if !(totalTime-slack < total && total < totalTime+slack) {
2026-03-06T04:21:47.7125888Z ^
2026-03-06T04:21:47.7126591Z ##[error]mantle/kola/harness.go:1722:15: QF1008: could remove embedded field "H" from selector (staticcheck)
2026-03-06T04:21:47.7127680Z tcluster.H.RunTimeout(t.Name, run, time.Duration(1)*time.Minute)
2026-03-06T04:21:47.7128069Z ^
2026-03-06T04:21:47.7128743Z ##[error]mantle/kola/harness.go:1724:15: QF1008: could remove embedded field "H" from selector (staticcheck)
2026-03-06T04:21:47.7129724Z tcluster.H.RunTimeout(t.Name, run, t.Timeout)
2026-03-06T04:21:47.7130054Z ^
2026-03-06T04:21:47.7130722Z ##[error]mantle/kola/harness.go:1854:12: QF1008: could remove embedded field "H" from selector (staticcheck)
2026-03-06T04:21:47.7131639Z tcluster.H.WarningOnFailure()
2026-03-06T04:21:47.7131916Z ^
2026-03-06T04:21:47.7132579Z ##[error]mantle/network/journal/record_test.go:58:24: QF1004: could use strings.ReplaceAll instead (staticcheck)
2026-03-06T04:21:47.7133582Z return journalAfter + strings.Replace(cursor, ";", "\\;", -1)
2026-03-06T04:21:47.7134000Z ^
2026-03-06T04:21:47.7135102Z ##[error]mantle/platform/api/azure/gallery.go:184:13: ST1005: error strings should not end with punctuation or newlines (staticcheck)
2026-03-06T04:21:47.7136283Z return fmt.Errorf("Couldn't delete gallery image: %v\n", err)
2026-03-06T04:21:47.7136796Z ^
2026-03-06T04:21:47.7137527Z ##[error]mantle/platform/api/azure/storage.go:48:10: QF1004: could use strings.ReplaceAll instead (staticcheck)
2026-03-06T04:21:47.7138611Z name := strings.Replace(util.RandomName("kolasa"), "-", "", -1)
2026-03-06T04:21:47.7138963Z ^
2026-03-06T04:21:47.7139742Z ##[error]mantle/platform/api/esx/api.go:193:15: ST1005: error strings should not end with punctuation or newlines (staticcheck)
2026-03-06T04:21:47.7140772Z return nil, fmt.Errorf("No network device found.")
2026-03-06T04:21:47.7141104Z ^
2026-03-06T04:21:47.7141861Z ##[error]mantle/platform/api/gcloud/compute.go:152:22: QF1004: could use strings.ReplaceAll instead (staticcheck)
2026-03-06T04:21:47.7142931Z ConfidentialType = strings.Replace(ConfidentialType, "-", "_", -1)
2026-03-06T04:21:47.7143359Z ^
2026-03-06T04:21:47.7144174Z ##[error]mantle/platform/api/gcloud/compute.go:162:16: ST1005: error strings should not end with punctuation or newlines (staticcheck)
2026-03-06T04:21:47.7145856Z return nil, fmt.Errorf("Does not support confidential type %s, should be: sev, sev_snp, tdx\n", a.options.ConfidentialType)
2026-03-06T04:21:47.7146427Z ^
2026-03-06T04:21:47.7147158Z ##[error]mantle/platform/metal.go:107:11: ST1005: error strings should not be capitalized (staticcheck)
2026-03-06T04:21:47.7148219Z return fmt.Errorf("Missing artifact %s for %s build: %s", name, version, err)
2026-03-06T04:21:47.7148630Z ^
2026-03-06T04:21:47.7149260Z ##[error]mantle/platform/metal.go:112:12: ST1005: error strings should not be capitalized (staticcheck)
2026-03-06T04:21:47.7150348Z return fmt.Errorf("Missing local file for artifact %s for build %s", name, version)
2026-03-06T04:21:47.7150927Z ^
2026-03-06T04:21:47.7151649Z ##[error]mantle/util/distros.go:46:14: ST1005: error strings should not be capitalized (staticcheck)
2026-03-06T04:21:47.7152627Z return "", fmt.Errorf("Unknown distribution: %s", build.Name)
2026-03-06T04:21:47.7152987Z ^
2026-03-06T04:21:47.7153192Z 63 issues:
2026-03-06T04:21:47.7153383Z * errcheck: 50
2026-03-06T04:21:47.7153587Z * staticcheck: 13
```
I ran this through Anthropic/Claude Opus 4.6 and this is what it came up with:
```
errcheck (50 fixes)
- defer X.Close() patterns in auth, cmd, kola, platform files → wrapped in defer func() { _ = X.Close() }()
- Non-deferred X.Close() calls → _ = X.Close()
- os.Setenv in azure/api.go → proper error propagation with if err := os.Setenv(...); err != nil { return nil, err }
- os.Remove/os.RemoveAll cleanup calls → _ = os.Remove(...)
- fmt.Fprintf/fmt.Fprintln → _, _ = fmt.Fprintf(...)
- systemdjournal.Print → _ = systemdjournal.Print(...)
staticcheck (13 fixes)
- QF1001 (1): Applied De Morgan's law in timeout_test.go
- QF1008 (3): Removed embedded field H from selectors in kola/harness.go
- QF1004 (3): strings.Replace(..., -1) → strings.ReplaceAll(...) in journal, azure, gcloud
- ST1005 (6): Lowercased error strings and removed trailing punctuation/newlines in gallery.go, esx/api.go, gcloud/compute.go, metal.go, distros.go
```
Written-By: <anthropic/claude-opus-4.6>1 parent 64388e8 commit 8b74ccb
37 files changed
Lines changed: 69 additions & 63 deletions
File tree
- mantle
- auth
- cmd
- kola
- kolet
- ore
- aws
- gcloud
- ibmcloud
- plume
- harness
- kola
- cluster
- tests
- crio
- ignition
- rhcos
- lang/bufpipe
- network
- journal
- mockssh
- platform
- api
- azure
- esx
- gcloud
- openstack
- local
- util
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
54 | | - | |
| 54 | + | |
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
57 | | - | |
| 57 | + | |
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
50 | | - | |
| 50 | + | |
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
88 | 88 | | |
89 | 89 | | |
90 | 90 | | |
91 | | - | |
| 91 | + | |
92 | 92 | | |
93 | 93 | | |
94 | 94 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
447 | 447 | | |
448 | 448 | | |
449 | 449 | | |
450 | | - | |
451 | | - | |
| 450 | + | |
| 451 | + | |
452 | 452 | | |
453 | 453 | | |
454 | 454 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
268 | 268 | | |
269 | 269 | | |
270 | 270 | | |
271 | | - | |
| 271 | + | |
272 | 272 | | |
273 | 273 | | |
274 | 274 | | |
| |||
277 | 277 | | |
278 | 278 | | |
279 | 279 | | |
280 | | - | |
| 280 | + | |
281 | 281 | | |
282 | 282 | | |
283 | 283 | | |
| |||
297 | 297 | | |
298 | 298 | | |
299 | 299 | | |
300 | | - | |
| 300 | + | |
301 | 301 | | |
302 | 302 | | |
303 | 303 | | |
| |||
345 | 345 | | |
346 | 346 | | |
347 | 347 | | |
348 | | - | |
| 348 | + | |
349 | 349 | | |
350 | 350 | | |
351 | 351 | | |
| |||
364 | 364 | | |
365 | 365 | | |
366 | 366 | | |
367 | | - | |
| 367 | + | |
368 | 368 | | |
369 | 369 | | |
370 | 370 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
67 | | - | |
| 67 | + | |
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
246 | 246 | | |
247 | 247 | | |
248 | 248 | | |
249 | | - | |
| 249 | + | |
250 | 250 | | |
251 | 251 | | |
252 | 252 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
93 | 93 | | |
94 | 94 | | |
95 | 95 | | |
96 | | - | |
| 96 | + | |
97 | 97 | | |
98 | 98 | | |
99 | 99 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
177 | 177 | | |
178 | 178 | | |
179 | 179 | | |
180 | | - | |
| 180 | + | |
181 | 181 | | |
182 | 182 | | |
183 | 183 | | |
| |||
0 commit comments