update golangci-lint to 1.60.1

Fixes new spotted issues around printf() formats and using os.Setenv()
in tests.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
This commit is contained in:
Paul Holzinger
2024-08-14 13:14:02 +02:00
parent 5f069d8742
commit c17daf2b09
10 changed files with 16 additions and 15 deletions

View File

@ -14,19 +14,19 @@ func TestSocketActivated(t *testing.T) {
assert.False(SocketActivated())
// different pid
assert.NoError(os.Setenv("LISTEN_PID", "1"))
t.Setenv("LISTEN_PID", "1")
assert.False(SocketActivated())
// same pid no fds
assert.NoError(os.Setenv("LISTEN_PID", strconv.Itoa(os.Getpid())))
assert.NoError(os.Setenv("LISTEN_FDS", "0"))
t.Setenv("LISTEN_PID", strconv.Itoa(os.Getpid()))
t.Setenv("LISTEN_FDS", "0")
assert.False(SocketActivated())
// same pid some fds
assert.NoError(os.Setenv("LISTEN_FDS", "1"))
t.Setenv("LISTEN_FDS", "1")
assert.True(SocketActivated())
// FDNAME is ok too (but not required)
assert.NoError(os.Setenv("LISTEN_FDNAMES", "/meshuggah/rocks"))
t.Setenv("LISTEN_FDNAMES", "/meshuggah/rocks")
assert.True(SocketActivated())
}

View File

@ -1775,7 +1775,7 @@ func handleUserRemap(unitFile *parser.UnitFile, groupName string, podman *Podman
autoOpts = append(autoOpts, fmt.Sprintf("size=%v", uidSize))
}
podman.addf("--userns=" + usernsOpts("auto", autoOpts))
podman.add("--userns=" + usernsOpts("auto", autoOpts))
case "keep-id":
if !isUser {
return fmt.Errorf("RemapUsers=keep-id is unsupported for system units")
@ -1795,7 +1795,7 @@ func handleUserRemap(unitFile *parser.UnitFile, groupName string, podman *Podman
keepidOpts = append(keepidOpts, "gid="+gidMaps[0])
}
podman.addf("--userns=" + usernsOpts("keep-id", keepidOpts))
podman.add("--userns=" + usernsOpts("keep-id", keepidOpts))
default:
return fmt.Errorf("unsupported RemapUsers option '%s'", remapUsers)