Skip to content

golangci-lint V2 breaking changes breaks ci-lint job

They recently released the new [version 2](https://github.com/golangci/golangci-lint "version 2

(https://github.com/golangci/golangci-lint)") which introduced [breaking changes](https://github.com/golangci/golangci-lint/issues/5364 "breaking changes

(https://github.com/golangci/golangci-lint/issues/5364)") removing the used --out-format.

If we check what do we have [now](https://gitlab.com/to-be-continuous/golang/-/blob/master/templates/gitlab-ci-golang.yml?ref_type=heads "now

(https://gitlab.com/to-be-continuous/golang/-/blob/master/templates/gitlab-ci-golang.yml?ref_type=heads)"):

golangci-lint run --out-format "colored-line-number:stdout,code-climate:reports/go-ci-lint.codeclimate.json,checkstyle:reports/go-ci-lint.checkstyle.xml" $GO_CI_LINT_ARGS

Should be changed for:

golangci-lint run --output.code-climate.path=reports/go-ci-lint.codeclimate.json --output.checkstyle.path=reports/go-ci-lint.checkstyle.xml --output.text.path=stdout $GO_CI_LINT_ARGS

Also mention that goimports (part of default GO_CI_LINT_ARGS) is no longer supported as a valid linter by the tool: it has to be removed.