From d645607caa016391f948362624be0311a29145fd Mon Sep 17 00:00:00 2001 From: Pierre Smeyers <pierre.smeyers@gmail.com> Date: Thu, 27 Mar 2025 10:05:01 +0100 Subject: [PATCH] fix(ci-lint): golangci-lint V2 no longer support --out-format arg --- templates/gitlab-ci-golang.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/templates/gitlab-ci-golang.yml b/templates/gitlab-ci-golang.yml index 9edc5fb..4fa21a1 100644 --- a/templates/gitlab-ci-golang.yml +++ b/templates/gitlab-ci-golang.yml @@ -719,7 +719,14 @@ go-ci-lint: script: - mkdir -p -m 777 reports # produce all reports at once - - 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 + - | + glc_ver_major=$(golangci-lint version | cut -d' ' -f4 | cut -d'.' -f1) + if [[ "$glc_major_ver" == "1" ]] + then + 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 + else + golangci-lint run --output.text.path stdout --output.code-climate.path reports/go-ci-lint.codeclimate.json --output.checkstyle.path reports/go-ci-lint.checkstyle.xml $GO_CI_LINT_ARGS + fi artifacts: name: "$CI_JOB_NAME artifacts from $CI_PROJECT_NAME on $CI_COMMIT_REF_SLUG" expire_in: 1 day -- GitLab