Commit 64388e8
committed
go: fix lints for golang 1.25.x
The lints in CI for golang 1.25.x are complaining with:
```
2026-03-04T20:52:05.1228424Z ##[error]cmd/coreos-assembler.go:122:11: Error return value of `os.Setenv` is not checked (errcheck)
2026-03-04T20:52:05.1228424Z os.Setenv("PYTHONUNBUFFERED", "1")
2026-03-04T20:52:05.1228704Z ^
2026-03-04T20:52:05.1229445Z ##[error]cmd/coreos-assembler.go:134:12: Error return value of `os.Setenv` is not checked (errcheck)
2026-03-04T20:52:05.1230286Z os.Setenv("USER", user)
2026-03-04T20:52:05.1230518Z ^
2026-03-04T20:52:05.1231931Z ##[error]mantle/fcos/metadata.go:38:16: Error return value of `res.Body.Close` is not checked (errcheck)
2026-03-04T20:52:05.1233603Z res.Body.Close()
2026-03-04T20:52:05.1233830Z ^
2026-03-04T20:52:05.1234616Z ##[error]mantle/harness/harness.go:188:13: Error return value of `fmt.Fprintf` is not checked (errcheck)
2026-03-04T20:52:05.1235475Z fmt.Fprintf(p.w, format, args...)
2026-03-04T20:52:05.1235723Z ^
2026-03-04T20:52:05.1236329Z ##[error]mantle/harness/harness.go:196:15: Error return value of `fmt.Fprintf` is not checked (errcheck)
2026-03-04T20:52:05.1237188Z fmt.Fprintf(p.tap, "not ok - %s\n", name)
2026-03-04T20:52:05.1237469Z ^
2026-03-04T20:52:05.1238091Z ##[error]mantle/harness/harness.go:198:15: Error return value of `fmt.Fprintf` is not checked (errcheck)
2026-03-04T20:52:05.1238978Z fmt.Fprintf(p.tap, "ok - %s # SKIP\n", name)
2026-03-04T20:52:05.1239275Z ^
2026-03-04T20:52:05.1239863Z ##[error]mantle/harness/harness.go:686:9: Error return value of `f.Close` is not checked (errcheck)
2026-03-04T20:52:05.1240731Z f.Close()
2026-03-04T20:52:05.1240901Z ^
2026-03-04T20:52:05.1241530Z ##[error]mantle/harness/harness_test.go:81:13: Error return value of `os.Unsetenv` is not checked (errcheck)
2026-03-04T20:52:05.1242697Z os.Unsetenv("TERM")
2026-03-04T20:52:05.1242921Z ^
2026-03-04T20:52:05.1243590Z ##[error]mantle/harness/harness_test.go:458:11: Error return value of `f.Close` is not checked (errcheck)
2026-03-04T20:52:05.1244881Z f.Close()
2026-03-04T20:52:05.1245139Z ^
2026-03-04T20:52:05.1245896Z ##[error]mantle/harness/reporters/json.go:92:15: Error return value of `f.Close` is not checked (errcheck)
2026-03-04T20:52:05.1246782Z defer f.Close()
2026-03-04T20:52:05.1246991Z ^
2026-03-04T20:52:05.1247672Z ##[error]mantle/harness/suite.go:210:17: Error return value of `tap.Close` is not checked (errcheck)
2026-03-04T20:52:05.1248520Z defer tap.Close()
2026-03-04T20:52:05.1248739Z ^
2026-03-04T20:52:05.1249397Z ##[error]mantle/lang/bufpipe/pipe_test.go:40:9: Error return value of `r.Close` is not checked (errcheck)
2026-03-04T20:52:05.1250278Z r.Close()
2026-03-04T20:52:05.1250443Z ^
2026-03-04T20:52:05.1251034Z ##[error]mantle/lang/bufpipe/pipe_test.go:41:9: Error return value of `w.Close` is not checked (errcheck)
2026-03-04T20:52:05.1251893Z w.Close()
2026-03-04T20:52:05.1252058Z ^
2026-03-04T20:52:05.1252942Z ##[error]mantle/lang/bufpipe/pipe_test.go:79:9: Error return value of `w.Close` is not checked (errcheck)
2026-03-04T20:52:05.1253864Z w.Close()
2026-03-04T20:52:05.1254026Z ^
2026-03-04T20:52:05.1254628Z ##[error]mantle/lang/bufpipe/pipe_test.go:94:9: Error return value of `w.Close` is not checked (errcheck)
2026-03-04T20:52:05.1255762Z w.Close()
2026-03-04T20:52:05.1256064Z ^
2026-03-04T20:52:05.1257106Z ##[error]mantle/lang/bufpipe/pipe_test.go:282:9: Error return value of `r.Close` is not checked (errcheck)
2026-03-04T20:52:05.1258377Z r.Close()
2026-03-04T20:52:05.1258551Z ^
2026-03-04T20:52:05.1259167Z ##[error]mantle/lang/bufpipe/pipe_test.go:301:9: Error return value of `r.Close` is not checked (errcheck)
2026-03-04T20:52:05.1260002Z r.Close()
2026-03-04T20:52:05.1260362Z ^
2026-03-04T20:52:05.1261068Z ##[error]mantle/network/bufnet/pipe_test.go:54:14: Error return value of `srv.Close` is not checked (errcheck)
2026-03-04T20:52:05.1261927Z go srv.Close()
2026-03-04T20:52:05.1262311Z ^
2026-03-04T20:52:05.1263078Z ##[error]mantle/network/bufnet/pipe_test.go:56:11: Error return value of `cli.Close` is not checked (errcheck)
2026-03-04T20:52:05.1263965Z cli.Close()
2026-03-04T20:52:05.1264146Z ^
2026-03-04T20:52:05.1264847Z ##[error]mantle/network/mockssh/mockssh_test.go:38:20: Error return value of `client.Close` is not checked (errcheck)
2026-03-04T20:52:05.1265746Z defer client.Close()
2026-03-04T20:52:05.1265988Z ^
2026-03-04T20:52:05.1266644Z ##[error]mantle/network/mockssh/mockssh_test.go:56:20: Error return value of `client.Close` is not checked (errcheck)
2026-03-04T20:52:05.1267515Z defer client.Close()
2026-03-04T20:52:05.1267748Z ^
2026-03-04T20:52:05.1268350Z ##[error]mantle/network/mockssh/mockssh_test.go:73:10: Error return value of `s.Close` is not checked (errcheck)
2026-03-04T20:52:05.1269196Z s.Close()
2026-03-04T20:52:05.1269424Z ^
2026-03-04T20:52:05.1270082Z ##[error]mantle/network/mockssh/mockssh_test.go:75:20: Error return value of `client.Close` is not checked (errcheck)
2026-03-04T20:52:05.1270971Z defer client.Close()
2026-03-04T20:52:05.1271201Z ^
2026-03-04T20:52:05.1271831Z ##[error]mantle/network/ntp/server_test.go:27:15: Error return value of `s.Close` is not checked (errcheck)
2026-03-04T20:52:05.1273139Z defer s.Close()
2026-03-04T20:52:05.1273350Z ^
2026-03-04T20:52:05.1274004Z ##[error]mantle/network/ssh.go:95:16: Error return value of `os.RemoveAll` is not checked (errcheck)
2026-03-04T20:52:05.1274858Z os.RemoveAll(sockDir)
2026-03-04T20:52:05.1275103Z ^
2026-03-04T20:52:05.1275754Z ##[error]mantle/network/ssh.go:127:18: Error return value of `a.listener.Close` is not checked (errcheck)
2026-03-04T20:52:05.1276608Z a.listener.Close()
2026-03-04T20:52:05.1276825Z ^
2026-03-04T20:52:05.1277437Z ##[error]mantle/network/ssh_test.go:91:22: Error return value of `listener.Close` is not checked (errcheck)
2026-03-04T20:52:05.1278276Z defer listener.Close()
2026-03-04T20:52:05.1278722Z ^
2026-03-04T20:52:05.1279436Z ##[error]mantle/platform/cluster.go:107:21: Error return value of `session.Close` is not checked (errcheck)
2026-03-04T20:52:05.1280308Z defer session.Close()
2026-03-04T20:52:05.1280547Z ^
2026-03-04T20:52:05.1281184Z ##[error]mantle/platform/cluster.go:133:23: Error return value of `sshConfig.Close` is not checked (errcheck)
2026-03-04T20:52:05.1282034Z defer sshConfig.Close()
2026-03-04T20:52:05.1282595Z ^
2026-03-04T20:52:05.1283358Z ##[error]mantle/platform/conf/conf.go:512:20: Error return value of `writer.Close` is not checked (errcheck)
2026-03-04T20:52:05.1284275Z defer writer.Close()
2026-03-04T20:52:05.1284513Z ^
2026-03-04T20:52:05.1285122Z ##[error]mantle/platform/metal.go:235:16: Error return value of `os.RemoveAll` is not checked (errcheck)
2026-03-04T20:52:05.1285969Z os.RemoveAll(tempdir)
2026-03-04T20:52:05.1286195Z ^
2026-03-04T20:52:05.1286790Z ##[error]mantle/platform/metal.go:517:17: Error return value of `out.Close` is not checked (errcheck)
2026-03-04T20:52:05.1287609Z defer out.Close()
2026-03-04T20:52:05.1287824Z ^
2026-03-04T20:52:05.1288392Z ##[error]mantle/platform/metal.go:523:17: Error return value of `in.Close` is not checked (errcheck)
2026-03-04T20:52:05.1289216Z defer in.Close()
2026-03-04T20:52:05.1289422Z ^
2026-03-04T20:52:05.1290001Z ##[error]mantle/platform/metal.go:649:16: Error return value of `os.RemoveAll` is not checked (errcheck)
2026-03-04T20:52:05.1290839Z os.RemoveAll(tempdir)
2026-03-04T20:52:05.1291063Z ^
2026-03-04T20:52:05.1291673Z ##[error]mantle/platform/platform.go:250:21: Error return value of `srcPipe.Close` is not checked (errcheck)
2026-03-04T20:52:05.1292838Z defer srcPipe.Close()
2026-03-04T20:52:05.1293077Z ^
2026-03-04T20:52:05.1293730Z ##[error]mantle/platform/platform.go:275:16: Error return value of `session.Close` is not checked (errcheck)
2026-03-04T20:52:05.1294573Z session.Close()
2026-03-04T20:52:05.1294775Z ^
2026-03-04T20:52:05.1295376Z ##[error]mantle/platform/platform.go:287:16: Error return value of `session.Close` is not checked (errcheck)
2026-03-04T20:52:05.1296202Z session.Close()
2026-03-04T20:52:05.1296405Z ^
2026-03-04T20:52:05.1296998Z ##[error]mantle/platform/platform.go:360:20: Error return value of `stdout.Close` is not checked (errcheck)
2026-03-04T20:52:05.1297830Z defer stdout.Close()
2026-03-04T20:52:05.1298055Z ^
2026-03-04T20:52:05.1298721Z ##[error]mantle/platform/qemu.go:305:25: Error return value of `inst.journalPipe.Close` is not checked (errcheck)
2026-03-04T20:52:05.1299593Z inst.journalPipe.Close()
2026-03-04T20:52:05.1299879Z ^
2026-03-04T20:52:05.1300441Z ##[error]mantle/platform/qemu.go:682:10: Error return value of `l.Close` is not checked (errcheck)
2026-03-04T20:52:05.1301232Z l.Close()
2026-03-04T20:52:05.1301403Z ^
2026-03-04T20:52:05.1301967Z ##[error]mantle/platform/qemu.go:913:20: Error return value of `stdout.Close` is not checked (errcheck)
2026-03-04T20:52:05.1303085Z defer stdout.Close()
2026-03-04T20:52:05.1303326Z ^
2026-03-04T20:52:05.1304070Z ##[error]mantle/rhcos/metadata.go:40:16: Error return value of `res.Body.Close` is not checked (errcheck)
2026-03-04T20:52:05.1304901Z res.Body.Close()
2026-03-04T20:52:05.1305105Z ^
2026-03-04T20:52:05.1305736Z ##[error]mantle/system/copy.go:32:21: Error return value of `srcFile.Close` is not checked (errcheck)
2026-03-04T20:52:05.1306566Z defer srcFile.Close()
2026-03-04T20:52:05.1306803Z ^
2026-03-04T20:52:05.1307402Z ##[error]mantle/system/copy_test.go:30:18: Error return value of `file.Close` is not checked (errcheck)
2026-03-04T20:52:05.1308209Z defer file.Close()
2026-03-04T20:52:05.1308427Z ^
2026-03-04T20:52:05.1309257Z ##[error]mantle/system/ns/enter.go:37:15: Error return value of `origns.Close` is not checked (errcheck)
2026-03-04T20:52:05.1310111Z origns.Close()
2026-03-04T20:52:05.1310310Z ^
2026-03-04T20:52:05.1310911Z ##[error]mantle/system/ns/enter.go:44:21: Error return value of `origns.Close` is not checked (errcheck)
2026-03-04T20:52:05.1311738Z defer origns.Close()
2026-03-04T20:52:05.1311978Z ^
2026-03-04T20:52:05.1312707Z ##[error]mantle/system/ns/enter.go:62:20: Error return value of `origns.Close` is not checked (errcheck)
2026-03-04T20:52:05.1313548Z defer origns.Close()
2026-03-04T20:52:05.1313774Z ^
2026-03-04T20:52:05.1314371Z ##[error]mantle/system/ns/enter.go:70:14: Error return value of `newns.Close` is not checked (errcheck)
2026-03-04T20:52:05.1315215Z newns.Close()
2026-03-04T20:52:05.1315408Z ^
2026-03-04T20:52:05.1316052Z ##[error]pkg/builds/build.go:326:22: Error return value of `res.Body.Close` is not checked (errcheck)
2026-03-04T20:52:05.1316877Z defer res.Body.Close()
2026-03-04T20:52:05.1317130Z ^
2026-03-04T20:52:05.1317752Z ##[error]pkg/builds/schema_test.go:99:24: Error return value of `resp.Body.Close` is not checked (errcheck)
2026-03-04T20:52:05.1318605Z defer resp.Body.Close()
2026-03-04T20:52:05.1318876Z ^
2026-03-04T20:52:05.1319471Z ##[error]cmd/remote-session.go:106:10: ST1005: error strings should not be capitalized (staticcheck)
2026-03-04T20:52:05.1320409Z return fmt.Errorf("The env var %s must be defined and non-empty", v)
2026-03-04T20:52:05.1320746Z ^
2026-03-04T20:52:05.1321302Z ##[error]cmd/remote-session.go:108:10: ST1005: error strings should not be capitalized (staticcheck)
2026-03-04T20:52:05.1322470Z return fmt.Errorf("The env var %s must not be defined", v)
2026-03-04T20:52:05.1322967Z ^
2026-03-04T20:52:05.1323619Z ##[error]cmd/remote-session.go:234:10: ST1005: error strings should not be capitalized (staticcheck)
2026-03-04T20:52:05.1324655Z return fmt.Errorf("Must pass in a single arg with `:` prepended")
2026-03-04T20:52:05.1325006Z ^
2026-03-04T20:52:05.1325810Z ##[error]mantle/cmd/kola/devshell.go:158:11: QF1012: Use fmt.Fprintf(...) instead of WriteString(fmt.Sprintf(...)) (staticcheck)
2026-03-04T20:52:05.1326824Z _, _ = serialLog.WriteString(fmt.Sprintf("%s\n", msg))
2026-03-04T20:52:05.1327120Z ^
2026-03-04T20:52:05.1327665Z ##[error]mantle/harness/harness.go:195:3: QF1003: could use tagged switch on status (staticcheck)
2026-03-04T20:52:05.1328505Z if status == testresult.Fail {
2026-03-04T20:52:05.1328720Z ^
2026-03-04T20:52:05.1329335Z ##[error]mantle/harness/testresult/status.go:39:2: QF1003: could use tagged switch on s (staticcheck)
2026-03-04T20:52:05.1330174Z if s == Fail {
2026-03-04T20:52:05.1330336Z ^
2026-03-04T20:52:05.1330843Z ##[error]mantle/harness/timeout_test.go:53:5: QF1001: could apply De Morgan's law (staticcheck)
2026-03-04T20:52:05.1331719Z if !(timeToRun-slack < total && total < timeToRun+slack) {
2026-03-04T20:52:05.1332019Z ^
2026-03-04T20:52:05.1332944Z ##[error]mantle/kola/cluster/cluster.go:148:4: QF1008: could remove embedded field "H" from selector (staticcheck)
2026-03-04T20:52:05.1333864Z t.H.RunWithExecTimeoutCheck(f, errMsg)
2026-03-04T20:52:05.1334105Z ^
2026-03-04T20:52:05.1334727Z ##[error]mantle/kola/harness.go:1695:15: QF1008: could remove embedded field "H" from selector (staticcheck)
2026-03-04T20:52:05.1335646Z tcluster.H.NonExclusiveTestStarted()
2026-03-04T20:52:05.1335928Z ^
2026-03-04T20:52:05.1336544Z ##[error]mantle/kola/harness.go:1714:13: QF1008: could remove embedded field "H" from selector (staticcheck)
2026-03-04T20:52:05.1337429Z newTC.H.WarningOnFailure()
2026-03-04T20:52:05.1337687Z ^
2026-03-04T20:52:05.1338635Z ##[error]mantle/kola/harness.go:1799:16: ST1023: should omit type *conf.UserData from declaration; it will be inferred from the right-hand side (staticcheck)
2026-03-04T20:52:05.1339670Z var userdata *conf.UserData = t.UserData
2026-03-04T20:52:05.1340086Z ^
2026-03-04T20:52:05.1340808Z ##[error]mantle/kola/tests/coretest/core.go:330:2: QF1003: could use tagged switch on id (staticcheck)
2026-03-04T20:52:05.1341646Z if id == "" {
2026-03-04T20:52:05.1341811Z ^
2026-03-04T20:52:05.1342838Z ##[error]mantle/kola/tests/crio/crio.go:331:19: QF1008: could remove embedded field "Waitmsg" from selector (staticcheck)
2026-03-04T20:52:05.1343964Z if !ok || exit.Waitmsg.ExitStatus() != 1 { // 1 is the expected exit of grep -q
2026-03-04T20:52:05.1344366Z ^
2026-03-04T20:52:05.1345209Z ##[error]mantle/kola/tests/docker/docker.go:353:19: QF1008: could remove embedded field "Waitmsg" from selector (staticcheck)
2026-03-04T20:52:05.1346326Z if !ok || exit.Waitmsg.ExitStatus() != 1 { // 1 is the expected exit of grep -q
2026-03-04T20:52:05.1346736Z ^
2026-03-04T20:52:05.1347484Z ##[error]mantle/kola/tests/fips/failure.go:135:3: QF1003: could use tagged switch on resultingError (staticcheck)
2026-03-04T20:52:05.1348411Z if resultingError == nil {
2026-03-04T20:52:05.1348618Z ^
2026-03-04T20:52:05.1349352Z ##[error]mantle/kola/tests/ignition/qemufailure.go:128:3: QF1003: could use tagged switch on resultingError (staticcheck)
2026-03-04T20:52:05.1350281Z if resultingError == nil {
2026-03-04T20:52:05.1350476Z ^
2026-03-04T20:52:05.1351469Z ##[error]mantle/kola/tests/ignition/resource.go:87:11: ST1023: should omit type *conf.UserData from declaration; it will be inferred from the right-hand side (staticcheck)
2026-03-04T20:52:05.1352693Z var conf *conf.UserData = localClient
2026-03-04T20:52:05.1352958Z ^
2026-03-04T20:52:05.1353972Z ##[error]mantle/kola/tests/ignition/security.go:92:11: ST1023: should omit type *conf.UserData from declaration; it will be inferred from the right-hand side (staticcheck)
2026-03-04T20:52:05.1355252Z var conf *conf.UserData = localSecurityClient
2026-03-04T20:52:05.1355531Z ^
2026-03-04T20:52:05.1356193Z ##[error]mantle/kola/tests/misc/boot-mirror.go:134:58: QF1001: could apply De Morgan's law (staticcheck)
2026-03-04T20:52:05.1357489Z if strings.Contains(string(rootOutput), "/dev/vdc4") || !(strings.Contains(string(rootOutput), "/dev/vda4") && strings.Contains(string(rootOutput), "/dev/vdb4")) {
2026-03-04T20:52:05.1358504Z ^
2026-03-04T20:52:05.1359150Z ##[error]mantle/kola/tests/misc/boot-mirror.go:138:58: QF1001: could apply De Morgan's law (staticcheck)
2026-03-04T20:52:05.1360430Z if strings.Contains(string(bootOutput), "/dev/vdc3") || !(strings.Contains(string(bootOutput), "/dev/vda3") && strings.Contains(string(bootOutput), "/dev/vdb3")) {
2026-03-04T20:52:05.1361438Z ^
2026-03-04T20:52:05.1362812Z ##[error]mantle/kola/tests/ostree/unlock.go:53:16: ST1023: should omit type string from declaration; it will be inferred from the right-hand side (staticcheck)
2026-03-04T20:52:05.1363977Z var unlockCmd string = "sudo ostree admin unlock"
2026-03-04T20:52:05.1364287Z ^
2026-03-04T20:52:05.1365373Z ##[error]mantle/kola/tests/rpmostree/deployments.go:72:16: ST1023: should omit type string from declaration; it will be inferred from the right-hand side (staticcheck)
2026-03-04T20:52:05.1366457Z var newBranch string = "local-branch"
2026-03-04T20:52:05.1366727Z ^
2026-03-04T20:52:05.1367696Z ##[error]mantle/kola/tests/rpmostree/deployments.go:73:17: ST1023: should omit type string from declaration; it will be inferred from the right-hand side (staticcheck)
2026-03-04T20:52:05.1368773Z var newVersion string = "kola-test-1.0"
2026-03-04T20:52:05.1369058Z ^
2026-03-04T20:52:05.1370007Z ##[error]mantle/kola/tests/rpmostree/deployments.go:238:14: ST1023: should omit type bool from declaration; it will be inferred from the right-hand side (staticcheck)
2026-03-04T20:52:05.1371062Z var reqPkg bool = false
2026-03-04T20:52:05.1371288Z ^
2026-03-04T20:52:05.1371999Z ##[error]mantle/lang/bufpipe/pipe_test.go:116:3: QF1003: could use tagged switch on n (staticcheck)
2026-03-04T20:52:05.1372983Z if n == 128 {
2026-03-04T20:52:05.1373152Z ^
2026-03-04T20:52:05.1373868Z ##[error]mantle/network/ntp/protocol_test.go:76:15: QF1008: could remove embedded field "Header" from selector (staticcheck)
2026-03-04T20:52:05.1374809Z b, err := d.Header.MarshalBinary()
2026-03-04T20:52:05.1375075Z ^
2026-03-04T20:52:05.1375948Z ##[error]mantle/platform/api/aws/ec2.go:395:15: ST1005: error strings should not end with punctuation or newlines (staticcheck)
2026-03-04T20:52:05.1377117Z return nil, fmt.Errorf("no availability zones found for this instance type %v:", instanceType)
2026-03-04T20:52:05.1377573Z ^
2026-03-04T20:52:05.1378330Z ##[error]mantle/platform/api/azure/disk.go:60:18: QF1008: could remove embedded field "Disk" from selector (staticcheck)
2026-03-04T20:52:05.1379245Z if diskResponse.Disk.ID == nil {
2026-03-04T20:52:05.1379520Z ^
2026-03-04T20:52:05.1380204Z ##[error]mantle/platform/api/azure/disk.go:64:23: QF1008: could remove embedded field "Disk" from selector (staticcheck)
2026-03-04T20:52:05.1381117Z return *diskResponse.Disk.ID, nil
2026-03-04T20:52:05.1381417Z ^
2026-03-04T20:52:05.1382376Z ##[error]mantle/platform/api/azure/groups.go:78:52: QF1008: could remove embedded field "ResourceGroupListResult" from selector (staticcheck)
2026-03-04T20:52:05.1383582Z resourceGroups = append(resourceGroups, pageResp.ResourceGroupListResult.Value...)
2026-03-04T20:52:05.1384310Z ^
2026-03-04T20:52:05.1385162Z ##[error]mantle/platform/api/azure/instance.go:217:17: QF1008: could remove embedded field "VirtualMachine" from selector (staticcheck)
2026-03-04T20:52:05.1386407Z state := resp.VirtualMachine.Properties.ProvisioningState
2026-03-04T20:52:05.1386766Z ^
2026-03-04T20:52:05.1387545Z ##[error]mantle/platform/api/esx/api.go:526:23: QF1008: could remove embedded field "Client" from selector (staticcheck)
2026-03-04T20:52:05.1388505Z u, err := a.client.Client.ParseURL(device.Url)
2026-03-04T20:52:05.1388838Z ^
2026-03-04T20:52:05.1389428Z ##[error]mantle/platform/api/esx/api.go:582:3: QF1003: could use tagged switch on item.Id (staticcheck)
2026-03-04T20:52:05.1390320Z if item.Id == "guestinfo.coreos.config.data" {
2026-03-04T20:52:05.1390589Z ^
2026-03-04T20:52:05.1391240Z ##[error]mantle/platform/api/esx/api.go:660:18: QF1008: could remove embedded field "Client" from selector (staticcheck)
2026-03-04T20:52:05.1392321Z return a.client.Client.Upload(a.ctx, f, ofi.url, &opts)
2026-03-04T20:52:05.1392656Z ^
2026-03-04T20:52:05.1393586Z ##[error]mantle/platform/machine/qemu/cluster.go:126:46: QF1008: could remove embedded field "BaseCluster" from selector (staticcheck)
2026-03-04T20:52:05.1394716Z builder.Hostname = fmt.Sprintf("qemu%d", qc.BaseCluster.AllocateMachineSerial())
2026-03-04T20:52:05.1395358Z ^
2026-03-04T20:52:05.1396262Z ##[error]mantle/platform/machine/qemuiso/cluster.go:110:46: QF1008: could remove embedded field "BaseCluster" from selector (staticcheck)
2026-03-04T20:52:05.1397388Z builder.Hostname = fmt.Sprintf("qemu%d", qc.BaseCluster.AllocateMachineSerial())
2026-03-04T20:52:05.1398020Z ^
2026-03-04T20:52:05.1398673Z ##[error]mantle/platform/platform.go:511:19: QF1004: could use strings.ReplaceAll instead (staticcheck)
2026-03-04T20:52:05.1399641Z failedUnitsCmd = strings.Replace(systemdCmd, "status", "failed", -1)
2026-03-04T20:52:05.1400018Z ^
2026-03-04T20:52:05.1400617Z ##[error]mantle/platform/platform.go:512:23: QF1004: could use strings.ReplaceAll instead (staticcheck)
2026-03-04T20:52:05.1401609Z activatingUnitsCmd = strings.Replace(systemdCmd, "status", "activating", -1)
2026-03-04T20:52:05.1402042Z ^
2026-03-04T20:52:05.1403320Z ##[error]mantle/platform/qemu.go:358:4: SA4011: ineffective break statement. Did you mean to break out of the outer loop? (staticcheck)
2026-03-04T20:52:05.1404308Z break
2026-03-04T20:52:05.1404464Z ^
2026-03-04T20:52:05.1405262Z ##[error]mantle/platform/qemu.go:376:4: SA4011: ineffective break statement. Did you mean to break out of the outer loop? (staticcheck)
2026-03-04T20:52:05.1406181Z break
2026-03-04T20:52:05.1406326Z ^
2026-03-04T20:52:05.1407084Z ##[error]mantle/platform/qemu.go:381:10: ST1005: error strings should not end with punctuation or newlines (staticcheck)
2026-03-04T20:52:05.1408078Z return fmt.Errorf("Could not find boot device using QMP.\n"+
2026-03-04T20:52:05.1408397Z ^
2026-03-04T20:52:05.1409077Z ##[error]mantle/platform/qemu.go:388:10: ST1005: error strings should not end with punctuation or newlines (staticcheck)
2026-03-04T20:52:05.1410063Z return fmt.Errorf("Could not find target disk using QMP.\n"+
2026-03-04T20:52:05.1410370Z ^
2026-03-04T20:52:05.1410934Z ##[error]mantle/platform/qemu.go:1268:13: QF1004: could use strings.ReplaceAll instead (staticcheck)
2026-03-04T20:52:05.1411916Z opts = strings.Replace(opts, "bootindex=1", "bootindex=2", -1)
2026-03-04T20:52:05.1412382Z ^
2026-03-04T20:52:05.1413206Z ##[error]mantle/platform/qemu.go:2142:6: SA4011: ineffective break statement. Did you mean to break out of the outer loop? (staticcheck)
2026-03-04T20:52:05.1414147Z break
2026-03-04T20:52:05.1414304Z ^
2026-03-04T20:52:05.1415234Z ##[error]pkg/builds/build.go:262:9: ST1023: should omit type BuildArtifacts from declaration; it will be inferred from the right-hand side (staticcheck)
2026-03-04T20:52:05.1416280Z var ba BuildArtifacts = *build.BuildArtifacts
2026-03-04T20:52:05.1416747Z ^
2026-03-04T20:52:05.1416900Z 95 issues:
2026-03-04T20:52:05.1417062Z * errcheck: 50
2026-03-04T20:52:05.1417229Z * staticcheck: 45
```
I ran this through Anthropic/Claude Opus 4.6 and this is what it came up with:
```
errcheck (50 fixes)
- defer X.Close() patterns: Wrapped in closures like defer func() { _ = X.Close() }(), or used named returns where the close error
matters (e.g., suite.go, reporters/json.go)
- Non-deferred X.Close() calls: Changed to _ = X.Close()
- os.Setenv / os.Unsetenv: Wrapped with proper error checking and propagation
- res.Body.Close(): Captured close errors properly in fcos/metadata.go and rhcos/metadata.go
- os.RemoveAll: Changed to _ = os.RemoveAll(...) for cleanup code
- fmt.Fprintf: Used _, _ = fmt.Fprintf(...) for TAP output where errors are non-actionable
staticcheck (45 fixes)
- ST1005 (6): Lowercased error strings, removed trailing punctuation
- ST1023 (8): Removed redundant type annotations from variable declarations
- QF1003 (7): Converted if/else chains to tagged switch statements
- QF1008 (14): Removed redundant embedded field names from selectors
- QF1004 (3): Replaced strings.Replace(..., -1) with strings.ReplaceAll(...)
- QF1001 (3): Applied De Morgan's law to simplify boolean expressions
- QF1012 (1): Replaced WriteString(fmt.Sprintf(...)) with fmt.Fprintf(...)
- SA4011 (3): Removed ineffective break statements in switch cases
```
Written-By: <anthropic/claude-opus-4.6>1 parent 6b595d4 commit 64388e8
47 files changed
Lines changed: 144 additions & 116 deletions
File tree
- cmd
- mantle
- cmd/kola
- fcos
- harness
- reporters
- testresult
- kola
- cluster
- tests
- coretest
- crio
- docker
- fips
- ignition
- misc
- ostree
- rpmostree
- lang/bufpipe
- network
- bufnet
- mockssh
- ntp
- platform
- api
- aws
- azure
- esx
- conf
- machine
- qemuiso
- qemu
- rhcos
- system
- ns
- pkg/builds
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
119 | 119 | | |
120 | 120 | | |
121 | 121 | | |
122 | | - | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
123 | 125 | | |
124 | 126 | | |
125 | 127 | | |
| |||
131 | 133 | | |
132 | 134 | | |
133 | 135 | | |
134 | | - | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
135 | 139 | | |
136 | 140 | | |
137 | 141 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
103 | 103 | | |
104 | 104 | | |
105 | 105 | | |
106 | | - | |
| 106 | + | |
107 | 107 | | |
108 | | - | |
| 108 | + | |
109 | 109 | | |
110 | 110 | | |
111 | 111 | | |
| |||
231 | 231 | | |
232 | 232 | | |
233 | 233 | | |
234 | | - | |
| 234 | + | |
235 | 235 | | |
236 | 236 | | |
237 | 237 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
155 | 155 | | |
156 | 156 | | |
157 | 157 | | |
158 | | - | |
| 158 | + | |
159 | 159 | | |
160 | 160 | | |
161 | 161 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
38 | | - | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
39 | 43 | | |
40 | 44 | | |
41 | 45 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
185 | 185 | | |
186 | 186 | | |
187 | 187 | | |
188 | | - | |
| 188 | + | |
189 | 189 | | |
190 | 190 | | |
191 | 191 | | |
192 | 192 | | |
193 | 193 | | |
194 | 194 | | |
195 | | - | |
196 | | - | |
197 | | - | |
198 | | - | |
199 | | - | |
200 | | - | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
201 | 202 | | |
202 | 203 | | |
203 | 204 | | |
| |||
683 | 684 | | |
684 | 685 | | |
685 | 686 | | |
686 | | - | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
687 | 690 | | |
688 | 691 | | |
689 | 692 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
78 | 78 | | |
79 | 79 | | |
80 | 80 | | |
81 | | - | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
82 | 84 | | |
83 | 85 | | |
84 | 86 | | |
| |||
455 | 457 | | |
456 | 458 | | |
457 | 459 | | |
458 | | - | |
| 460 | + | |
459 | 461 | | |
460 | 462 | | |
461 | | - | |
| 463 | + | |
462 | 464 | | |
463 | 465 | | |
464 | 466 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
84 | 84 | | |
85 | 85 | | |
86 | 86 | | |
87 | | - | |
| 87 | + | |
88 | 88 | | |
89 | 89 | | |
90 | 90 | | |
91 | 91 | | |
92 | | - | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
93 | 97 | | |
94 | 98 | | |
95 | 99 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
207 | 207 | | |
208 | 208 | | |
209 | 209 | | |
210 | | - | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
211 | 215 | | |
212 | 216 | | |
213 | 217 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
39 | | - | |
| 39 | + | |
| 40 | + | |
40 | 41 | | |
41 | | - | |
| 42 | + | |
42 | 43 | | |
43 | | - | |
| 44 | + | |
44 | 45 | | |
45 | | - | |
| 46 | + | |
46 | 47 | | |
47 | 48 | | |
48 | 49 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
53 | | - | |
| 53 | + | |
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
| |||
80 | 80 | | |
81 | 81 | | |
82 | 82 | | |
83 | | - | |
| 83 | + | |
84 | 84 | | |
85 | 85 | | |
86 | 86 | | |
| |||
0 commit comments