From 88fb976b42c29c7cc79501eebce68e938975e333 Mon Sep 17 00:00:00 2001 From: bakito Date: Thu, 29 Feb 2024 20:50:56 +0100 Subject: [PATCH] use go 1.22 --- .golangci.yaml | 52 +++++++++++++++++++------------------ go.mod | 2 +- pkg/export/worker/worker.go | 3 +-- pkg/uor/update.go | 5 ++-- 4 files changed, 31 insertions(+), 31 deletions(-) diff --git a/.golangci.yaml b/.golangci.yaml index a0cd859..5ae9445 100644 --- a/.golangci.yaml +++ b/.golangci.yaml @@ -3,35 +3,37 @@ run: linters: enable: - - asciicheck - - bodyclose - - dogsled - - durationcheck - - errcheck - - errorlint - - exportloopref - - gci - - gofmt - - gofumpt - - goimports - - gosec - - gosimple - - govet - - importas - - ineffassign - - megacheck - - misspell - - nakedret - - nolintlint - - staticcheck - - typecheck - - unconvert - - unparam - - unused + - asciicheck + - bodyclose + - dogsled + - durationcheck + - errcheck + - errorlint + - exportloopref + - gci + - gofmt + - gofumpt + - goimports + - gosec + - gosimple + - govet + - importas + - ineffassign + - megacheck + - misspell + - nakedret + - nolintlint + - staticcheck + - typecheck + - unconvert + - unparam + - unused linters-settings: gosec: # Exclude generated files exclude-generated: true + excludes: + - G601 # fixed in go 1.22 gofmt: # simplify code: gofmt with `-s` option, true by default simplify: true diff --git a/go.mod b/go.mod index 7cb6318..3dc1be9 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/bakito/kubexporter -go 1.21 +go 1.22 require ( github.com/Masterminds/sprig v2.22.0+incompatible diff --git a/pkg/export/worker/worker.go b/pkg/export/worker/worker.go index 29db002..7378d2b 100644 --- a/pkg/export/worker/worker.go +++ b/pkg/export/worker/worker.go @@ -300,8 +300,7 @@ func (w *worker) exportSingleResources(res *types.GroupResource, ul *unstructure } names := make(map[string]int) cnt := 0 - for i := range ul.Items { - u := ul.Items[i] + for _, u := range ul.Items { if !w.config.IsInstanceExcluded(res, u) { cnt++ w.stats.addNamespace(u.GetNamespace()) diff --git a/pkg/uor/update.go b/pkg/uor/update.go index d5e69ce..7357562 100644 --- a/pkg/uor/update.go +++ b/pkg/uor/update.go @@ -74,9 +74,8 @@ func updateFile(ctx context.Context, config *types.Config, file string, ac *clie owners := make(map[string]*unstructured.Unstructured) changed := false if len(refs) > 0 { - for i := range refs { - ref := &refs[i] - owner, err := findOwner(ctx, ac, owners, ref, us) + for _, ref := range refs { + owner, err := findOwner(ctx, ac, owners, &ref, us) if err != nil { errMsg := "" if errors.IsNotFound(err) {