Skip to content
Open
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
14 changes: 7 additions & 7 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@ 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:
# 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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion .go-version

This file was deleted.

159 changes: 77 additions & 82 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion merge/merge_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}
Expand Down
4 changes: 4 additions & 0 deletions mise.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[tools]
go = "1.24.10"
golangci-lint = "2.8.0"
ginkgo = "2.22.2"
3 changes: 1 addition & 2 deletions patch/deckpatch.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 2 additions & 4 deletions yamlbasics/selectors.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
}

Expand Down