Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use go 1.22 #374

Merged
merged 1 commit into from
Feb 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 27 additions & 25 deletions .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/bakito/kubexporter

go 1.21
go 1.22

require (
github.com/Masterminds/sprig v2.22.0+incompatible
Expand Down
3 changes: 1 addition & 2 deletions pkg/export/worker/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down
5 changes: 2 additions & 3 deletions pkg/uor/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 := "<ERROR>"
if errors.IsNotFound(err) {
Expand Down