libpod: fix a few minor staticcheck warnings

These:

> libpod/container_copy_common.go:34:16: QF1011: could omit type bool from declaration; it will be inferred from the right-hand side (staticcheck)
> 		locked       bool = true
> 		             ^
> libpod/container_internal_common.go:793:3: QF1006: could lift into loop condition (staticcheck)
> 		if maxSymLinks > 40 {
> 		^
> libpod/oci_conmon_linux.go:170:2: QF1007: could merge conditional assignment into variable declaration (staticcheck)
> 	mustCreateCgroup := true
> 	^

Should not result in any change of logic.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
This commit is contained in:
Kir Kolyshkin
2025-03-27 15:32:25 -07:00
parent 0105131b5c
commit 5aa035c69c
3 changed files with 5 additions and 12 deletions

View File

@ -788,12 +788,9 @@ func (c *Container) isWorkDirSymlink(resolvedPath string) bool {
// If so, that's a valid use case: return nil.
maxSymLinks := 0
for {
// Linux only supports a chain of 40 links.
// Reference: https://github.com/torvalds/linux/blob/master/include/linux/namei.h#L13
if maxSymLinks > 40 {
break
}
// Linux only supports a chain of 40 links.
// Reference: https://github.com/torvalds/linux/blob/master/include/linux/namei.h#L13
for maxSymLinks <= 40 {
resolvedSymlink, err := os.Readlink(resolvedPath)
if err != nil {
// End sym-link resolution loop.