diff options
author | Paul Holzinger <paul.holzinger@web.de> | 2021-01-12 15:16:12 +0100 |
---|---|---|
committer | Paul Holzinger <paul.holzinger@web.de> | 2021-01-12 16:11:09 +0100 |
commit | 8452b768ec96e84cd09766bddb65a34835844d6d (patch) | |
tree | 8258e7e73eb71fd76a1022d3b38ef6257c1234b4 /pkg/specgen/generate/validate.go | |
parent | 56819073147bec22badd6b5e424cd981d3383398 (diff) | |
download | podman-8452b768ec96e84cd09766bddb65a34835844d6d.tar.gz podman-8452b768ec96e84cd09766bddb65a34835844d6d.tar.bz2 podman-8452b768ec96e84cd09766bddb65a34835844d6d.zip |
Fix problems reported by staticcheck
`staticcheck` is a golang code analysis tool. https://staticcheck.io/
This commit fixes a lot of problems found in our code. Common problems are:
- unnecessary use of fmt.Sprintf
- duplicated imports with different names
- unnecessary check that a key exists before a delete call
There are still a lot of reported problems in the test files but I have
not looked at those.
Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
Diffstat (limited to 'pkg/specgen/generate/validate.go')
-rw-r--r-- | pkg/specgen/generate/validate.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/pkg/specgen/generate/validate.go b/pkg/specgen/generate/validate.go index f0ab4b994..77cccad3e 100644 --- a/pkg/specgen/generate/validate.go +++ b/pkg/specgen/generate/validate.go @@ -48,7 +48,7 @@ func verifyContainerResourcesCgroupV1(s *specgen.SpecGenerator) ([]string, error warnings = append(warnings, "Your kernel does not support memory swappiness capabilities, or the cgroup is not mounted. Memory swappiness discarded.") memory.Swappiness = nil } else { - if *memory.Swappiness < 0 || *memory.Swappiness > 100 { + if *memory.Swappiness > 100 { return warnings, errors.Errorf("invalid value: %v, valid memory swappiness range is 0-100", *memory.Swappiness) } } |