chore: update golangci-lint and fix all issues (#3575)

* chore: Update golangci-lint

Signed-off-by: Lars Francke <git@lars-francke.de>

* chore: fix all golangci-lint issues

- Remove deprecated `// +build` tags
- Fix godoclint, modernize, wsl_v5, govet, lll, gci, noctx issues
- Update linter configuration
- Modernize code to use Go 1.22+ features (for range N, slices.Contains, etc.)
- Update make check lint the privileged tests

Signed-off-by: Andrei Aaron <andreifdaaron@gmail.com>

---------

Signed-off-by: Lars Francke <git@lars-francke.de>
Signed-off-by: Andrei Aaron <andreifdaaron@gmail.com>
Co-authored-by: Lars Francke <git@lars-francke.de>
This commit is contained in:
Andrei Aaron
2025-11-22 23:36:48 +02:00
committed by GitHub
parent 566286ae42
commit da426850e7
242 changed files with 811 additions and 1010 deletions
+1 -1
View File
@@ -312,7 +312,7 @@ func (ib *BaseImageBuilder) EmptyLayer() ConfigBuilder {
}
func (ib *BaseImageBuilder) RandomLayers(count, size int) ConfigBuilder {
for i := 0; i < count; i++ {
for range count {
layer := make([]byte, size)
_, err := rand.Read(layer)
+2 -1
View File
@@ -143,13 +143,14 @@ func GetDefaultVulnConfig() ispec.Image {
}
}
// RandomString generates a random string.
// Adapted from https://gist.github.com/dopey/c69559607800d2f2f90b1b1ed4e550fb
func RandomString(n int) string {
const letters = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-"
ret := make([]byte, n)
for count := 0; count < n; count++ {
for count := range n {
num, err := rand.Int(rand.Reader, big.NewInt(int64(len(letters))))
if err != nil {
panic(err)