diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index e7cd58f..4bfa0d3 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -6,13 +6,10 @@ jobs: check: name: Check runs-on: ubuntu-latest - container: golangci/golangci-lint:v1.64.8-alpine + container: golangci/golangci-lint:v2.1.5-alpine steps: - uses: actions/checkout@v4 - run: | - # We need this go flag because it started to error after golangci-lint is using Go 1.21. - # TODO(slok): Remove it on next (>1.54.1) golangci-lint upgrade to check if this problem has gone. - export GOFLAGS="-buildvcs=false" ./scripts/check/check.sh unit-test: diff --git a/.golangci.yml b/.golangci.yml index ebcc58a..2362945 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,21 +1,30 @@ ---- +version: "2" run: - timeout: 3m build-tags: - integration - linters: enable: + - godot - misspell - - goimports - revive + settings: + revive: + rules: + # Spammy linter and complex to fix on lots of parameters. Makes more harm that it solves. + - name: unused-parameter + disabled: true + staticcheck: + checks: + - all + # Omit embedded fields from selector expression. + # https://staticcheck.dev/docs/checks/#QF1008 + - -QF1008 + exclusions: + generated: lax + presets: + - comments + - std-error-handling +formatters: + enable: - gofmt - #- depguard - - godot - -linters-settings: - revive: - rules: - # Spammy linter and complex to fix on lots of parameters. Makes more harm that it solves. - - name: unused-parameter - disabled: true \ No newline at end of file + - goimports diff --git a/cmd/kube-code-generator/main.go b/cmd/kube-code-generator/main.go index 54f3037..37a2a9e 100644 --- a/cmd/kube-code-generator/main.go +++ b/cmd/kube-code-generator/main.go @@ -83,7 +83,7 @@ func generateGoCode(ctx context.Context, cmdCfg CmdConfig, logger log.Logger, ge } if filepath.IsAbs(cmdCfg.GoCodeOutPath) { - return fmt.Errorf("Go generated code path should be relative") + return fmt.Errorf("go generated code path should be relative") } err := os.MkdirAll(cmdCfg.GoCodeOutPath, os.ModePerm) diff --git a/docker/dev/Dockerfile b/docker/dev/Dockerfile index 1e29fd6..08da80b 100644 --- a/docker/dev/Dockerfile +++ b/docker/dev/Dockerfile @@ -1,6 +1,6 @@ FROM golang:1.24 -ARG GOLANGCI_LINT_VERSION="1.64.8" +ARG GOLANGCI_LINT_VERSION="2.1.5" ARG MOCKERY_VERSION="3.2.5" ARG ostype=Linux diff --git a/scripts/check/check.sh b/scripts/check/check.sh index 824e59c..a9722e0 100755 --- a/scripts/check/check.sh +++ b/scripts/check/check.sh @@ -3,4 +3,4 @@ set -o errexit set -o nounset -golangci-lint run \ No newline at end of file +GOFLAGS="-buildvcs=false" golangci-lint run