From 525bc4d15a6a0205efa6fefede119cb2c14e2566 Mon Sep 17 00:00:00 2001 From: Michael Heap Date: Wed, 4 Feb 2026 12:33:04 +0000 Subject: [PATCH 1/5] Upgrade golangci-lint version --- .golangci.yml | 159 ++++++++++++++++++++++++-------------------------- 1 file changed, 77 insertions(+), 82 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index 59b5882..0244320 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,88 +1,83 @@ +version: "2" linters: enable: - - asciicheck - #- depguard - - dogsled - - durationcheck - - errcheck - - exhaustive - # - exportloopref - - gci - - goconst - - gofmt - - gofumpt - - goimports - - gomodguard - - gosec - - govet - - importas - - lll - - megacheck - - misspell - - nakedret - - nilerr - - nolintlint - - predeclared - #- revive - - stylecheck - - unconvert - - unparam - - wastedassign -issues: - exclude-rules: - - linters: + - asciicheck + - dogsled + - durationcheck + - exhaustive + - goconst + - gomodguard - gosec - text: "weak cryptographic primitive" - path: "state/indexers/md5Indexer.*" - - linters: - - gosec - text: "weak random number generator" - path: _test\.go - - linters: - - errcheck - text: "Error return value" # ignore err not checked in test files - path: _test\.go - - linters: - - gosec - text: "Expect WriteFile permissions to be 0600 or less" - path: file/codegen/main.go - # ignore unused warnings in test utils files - - linters: - - unused - - unparam - path: test_.* - # ignore SA1019 deprecation warning - - linters: + - importas + - lll + - misspell + - nakedret + - nilerr + - nolintlint + - predeclared - staticcheck - text: "SA1019.*" - # ignore formatting warnings in cmd/root.go due to nolint statements - - linters: - - gofumpt - text: "File is not `gofumpt`-ed" - path: cmd/root.go - - linters: + - unconvert + - unparam + - wastedassign + settings: + goconst: + min-occurrences: 10 + gomodguard: + blocked: + modules: + - github.com/ghodss/yaml: + recommendations: + - sigs.k8s.io/yaml + - gopkg.in/yaml.v2: + recommendations: + - sigs.k8s.io/yaml + exclusions: + generated: lax + presets: + - comments + - common-false-positives + - legacy + - std-error-handling + rules: + - linters: + - gosec + path: state/indexers/md5Indexer.* + text: weak cryptographic primitive + - linters: + - gosec + path: _test\.go + text: weak random number generator + - linters: + - errcheck + path: _test\.go + text: Error return value + - linters: + - gosec + path: file/codegen/main.go + text: Expect WriteFile permissions to be 0600 or less + - linters: + - unparam + - unused + path: test_.* + - linters: + - staticcheck + text: SA1019.* + paths: + - third_party$ + - builtin$ + - examples$ +formatters: + enable: + - gci - gofmt - text: "File is not `gofmt`-ed with `-s`" - path: cmd/root.go - - linters: + - gofumpt - goimports - text: "File is not `goimports`-ed" - path: cmd/root.go - -linters-settings: - goconst: - min-occurrences: 10 - gomodguard: - blocked: - modules: - - github.com/ghodss/yaml: - recommendations: - - sigs.k8s.io/yaml - - gopkg.in/yaml.v2: - recommendations: - - sigs.k8s.io/yaml - # The below package is required for the JSONpath library, see - # https://github.com/vmware-labs/yaml-jsonpath - # - gopkg.in/yaml.v3: - # recommendations: - # - sigs.k8s.io/yaml + exclusions: + generated: lax + paths: + - third_party$ + - builtin$ + - examples$ + - cmd/root.go + - cmd/root.go + - cmd/root.go From 84de047fad41bd6e256b30f297ed90773fd01649 Mon Sep 17 00:00:00 2001 From: Michael Heap Date: Wed, 4 Feb 2026 12:33:40 +0000 Subject: [PATCH 2/5] Replace .go-version with mise.toml --- .go-version | 1 - mise.toml | 4 ++++ 2 files changed, 4 insertions(+), 1 deletion(-) delete mode 100644 .go-version create mode 100644 mise.toml diff --git a/.go-version b/.go-version deleted file mode 100644 index c4bdc90..0000000 --- a/.go-version +++ /dev/null @@ -1 +0,0 @@ -1.24.10 diff --git a/mise.toml b/mise.toml new file mode 100644 index 0000000..6d629bf --- /dev/null +++ b/mise.toml @@ -0,0 +1,4 @@ +[tools] +go = "1.24.10" +golangci-lint = "2.8.0" +ginkgo = "2.22.2" From f4a1eeea3af3d1045df033bd70833ac9d1e393c1 Mon Sep 17 00:00:00 2001 From: Michael Heap Date: Wed, 4 Feb 2026 12:33:51 +0000 Subject: [PATCH 3/5] Fix linting errors --- merge/merge_test.go | 2 +- patch/deckpatch.go | 3 +-- yamlbasics/selectors.go | 6 ++---- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/merge/merge_test.go b/merge/merge_test.go index 0507e4e..11e7316 100644 --- a/merge/merge_test.go +++ b/merge/merge_test.go @@ -34,7 +34,7 @@ var _ = Describe("Merge", func() { result := MustSerialize(res, OutputFormatJSON) MustWriteSerializedFile("./merge_testfiles/"+ - strings.Replace(expected, "_expected.", "_generated.", -1), res, OutputFormatJSON) + strings.ReplaceAll(expected, "_expected.", "_generated."), res, OutputFormatJSON) Expect(result).To(MatchJSON(expectedResult)) } diff --git a/patch/deckpatch.go b/patch/deckpatch.go index 7197146..ee2ce4d 100644 --- a/patch/deckpatch.go +++ b/patch/deckpatch.go @@ -157,8 +157,7 @@ func (patch *DeckPatch) ApplyToNodes(yamlData *yaml.Node) (err error) { logbasics.Info("Patch has no selectors specified") } - //nolint:gosimple - if patch.Selectors == nil || len(patch.Selectors) == 0 { + if len(patch.Selectors) == 0 { patch.Selectors = make([]*jsonpath.JSONPath, len(patch.SelectorSources)) for i, selector := range patch.SelectorSources { patch.Selectors[i], err = jsonpath.NewPath(selector) diff --git a/yamlbasics/selectors.go b/yamlbasics/selectors.go index bf4e349..37e7c13 100644 --- a/yamlbasics/selectors.go +++ b/yamlbasics/selectors.go @@ -46,8 +46,7 @@ func NewSelectorSet(selectors []string) (SelectorSet, error) { // IsEmpty returns true if the selector set is empty. func (set *SelectorSet) IsEmpty() bool { - //nolint:gosimple - return set.selectors == nil || len(set.selectors) == 0 + return len(set.selectors) == 0 } // GetSources returns a copy of the selector sources @@ -68,8 +67,7 @@ func (set *SelectorSet) Find(nodeToSearch *yaml.Node) (NodeSet, error) { if nodeToSearch == nil { panic("expected nodeToSearch to be non-nil") } - //nolint:gosimple - if set.selectors == nil || len(set.selectors) == 0 { + if len(set.selectors) == 0 { return make(NodeSet, 0), nil } From 285a985eda76e7be85bf0996ee81bcf3699564fb Mon Sep 17 00:00:00 2001 From: Michael Heap Date: Wed, 4 Feb 2026 12:41:35 +0000 Subject: [PATCH 4/5] Use go-version-file in CI --- .github/workflows/golangci-lint.yml | 7 ++++--- .github/workflows/release.yaml | 2 +- .github/workflows/test.yml | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index 4658314..0a20a34 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -27,10 +27,11 @@ jobs: name: lint runs-on: ubuntu-latest steps: - - uses: actions/setup-go@v5 - # with: - # go-version: 1.17 - uses: actions/checkout@v4 + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version-file: go.mod - name: golangci-lint uses: golangci/golangci-lint-action@v6 # with: diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 676f3c8..c23f91c 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -24,7 +24,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v5 with: - go-version: 1.19 + go-version-file: go.mod - name: Run GoReleaser uses: goreleaser/goreleaser-action@v6 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b8c8a32..99de01d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -24,7 +24,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v5 with: - go-version: '^1.20' + go-version-file: go.mod - name: Set up ginkgo run: go install github.com/onsi/ginkgo/v2/ginkgo - name: Run Tests From bcabc2c2ad4513b8e63a71b1545bacfcab0d6b8d Mon Sep 17 00:00:00 2001 From: Michael Heap Date: Wed, 4 Feb 2026 12:45:48 +0000 Subject: [PATCH 5/5] Upgrade golangci-lint action --- .github/workflows/golangci-lint.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index 0a20a34..a5ac7c3 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -33,10 +33,9 @@ jobs: with: go-version-file: go.mod - name: golangci-lint - uses: golangci/golangci-lint-action@v6 - # with: - # Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version - # version: v3.0 + uses: golangci/golangci-lint-action@v9 + with: + version: v2.8.0 # Optional: working directory, useful for monorepos # working-directory: somedir