Skip to content

Commit 8b74ccb

Browse files
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/aliyun.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ func ReadAliyunConfig(path string) (map[string]AliyunProfile, error) {
5151
if err != nil {
5252
return nil, err
5353
}
54-
defer f.Close()
54+
defer func() { _ = f.Close() }()
5555

5656
var config AliyunConfig
5757
if err := json.NewDecoder(f).Decode(&config); err != nil {

mantle/auth/azure.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ func ReadAzureCredentials(path string) (AzureCredentials, error) {
5454
if err != nil {
5555
return azCreds, err
5656
}
57-
defer f.Close()
57+
defer func() { _ = f.Close() }()
5858

5959
content, err := io.ReadAll(f)
6060
if err != nil {

mantle/auth/do.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ func ReadDOConfig(path string) (map[string]DOProfile, error) {
4747
if err != nil {
4848
return nil, err
4949
}
50-
defer f.Close()
50+
defer func() { _ = f.Close() }()
5151

5252
var profiles map[string]DOProfile
5353
if err := json.NewDecoder(f).Decode(&profiles); err != nil {

mantle/cmd/kola/devshell.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ func runDevShellSSH(ctx context.Context, builder *platform.QemuBuilder, conf *co
8888
if err != nil {
8989
return err
9090
}
91-
defer agent.Close()
91+
defer func() { _ = agent.Close() }()
9292

9393
keys, err := agent.List()
9494
if err != nil {

mantle/cmd/kola/kola.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -447,8 +447,8 @@ func runList(cmd *cobra.Command, args []string) error {
447447
if !listJSON {
448448
var w = tabwriter.NewWriter(os.Stdout, 0, 8, 0, '\t', 0)
449449

450-
fmt.Fprintln(w, "Test Name\tPlatforms\tArchitectures\tDistributions\tTags")
451-
fmt.Fprintln(w, "\t")
450+
_, _ = fmt.Fprintln(w, "Test Name\tPlatforms\tArchitectures\tDistributions\tTags")
451+
_, _ = fmt.Fprintln(w, "\t")
452452
for _, item := range newtestlist {
453453
fmt.Fprintf(w, "%v\n", item)
454454
}

mantle/cmd/kolet/kolet.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ func dispatchRunExtUnit(ctx context.Context, unitname string, sdconn *systemddbu
268268
}
269269

270270
func initiateReboot(mark string) error {
271-
systemdjournal.Print(systemdjournal.PriInfo, "Processing reboot request")
271+
_ = systemdjournal.Print(systemdjournal.PriInfo, "Processing reboot request")
272272
res := kola.KoletResult{
273273
Reboot: string(mark),
274274
}
@@ -277,7 +277,7 @@ func initiateReboot(mark string) error {
277277
return errors.Wrapf(err, "serializing KoletResult")
278278
}
279279
fmt.Println(string(buf))
280-
systemdjournal.Print(systemdjournal.PriInfo, "Acknowledged reboot request with mark: %s", buf)
280+
_ = systemdjournal.Print(systemdjournal.PriInfo, "Acknowledged reboot request with mark: %s", buf)
281281
return nil
282282
}
283283

@@ -297,7 +297,7 @@ func mkfifo(path string) error {
297297
}
298298

299299
func initiateSoftReboot(mark string) error {
300-
systemdjournal.Print(systemdjournal.PriInfo, "Processing soft-reboot request")
300+
_ = systemdjournal.Print(systemdjournal.PriInfo, "Processing soft-reboot request")
301301
res := kola.KoletResult{
302302
SoftReboot: string(mark),
303303
}
@@ -345,7 +345,7 @@ func runExtUnit(cmd *cobra.Command, args []string) error {
345345
errChan <- err
346346
return
347347
}
348-
defer rebootReader.Close()
348+
defer func() { _ = rebootReader.Close() }()
349349
buf, err := io.ReadAll(rebootReader)
350350
if err != nil {
351351
errChan <- err
@@ -364,7 +364,7 @@ func runExtUnit(cmd *cobra.Command, args []string) error {
364364
errChan <- err
365365
return
366366
}
367-
defer softRebootReader.Close()
367+
defer func() { _ = softRebootReader.Close() }()
368368
buf, err := io.ReadAll(softRebootReader)
369369
if err != nil {
370370
errChan <- err

mantle/cmd/ore/aws/delete-image.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ func runDeleteImage(cmd *cobra.Command, args []string) {
6464
fmt.Fprintf(os.Stderr, "Warning: Encountered error when searching for snapshot for %s: %s. Continuing..\n", amiID, err)
6565
os.Exit(0)
6666
} else if snapshot == nil {
67-
fmt.Fprintf(os.Stdout, "No valid snapshot found for %s.\n", amiID)
67+
_, _ = fmt.Fprintf(os.Stdout, "No valid snapshot found for %s.\n", amiID)
6868
os.Exit(0)
6969
}
7070
snapshotID = snapshot.SnapshotID

mantle/cmd/ore/gcloud/upload.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ func writeFile(api *storage.Service, bucket, filename, destname string) error {
246246
if err != nil {
247247
return err
248248
}
249-
defer file.Close()
249+
defer func() { _ = file.Close() }()
250250

251251
req := api.Objects.Insert(bucket, &storage.Object{
252252
Name: destname,

mantle/cmd/ore/ibmcloud/ibmcloud.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ func preflightCheck(cmd *cobra.Command, args []string) error {
9393
os.Exit(1)
9494
}
9595
}
96-
defer file.Close()
96+
defer func() { _ = file.Close() }()
9797

9898
var apiKeyValues apiKeyFile
9999
bytes, err := io.ReadAll(file)

mantle/cmd/plume/release.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ func getReleaseMetadata(api *aws.API) release.Release {
177177
if err != nil {
178178
plog.Fatalf("downloading release metadata at %s: %v", releasePath, err)
179179
}
180-
defer releaseFile.Close()
180+
defer func() { _ = releaseFile.Close() }()
181181

182182
releaseData, err := io.ReadAll(releaseFile)
183183
if err != nil {

0 commit comments

Comments
 (0)