Skip to content
Snippets Groups Projects
Commit a9bc1cbe authored by Pierre Smeyers's avatar Pierre Smeyers
Browse files

Merge branch 'fix/golangci-lint-v2' into 'master'

Fix/golangci lint v2

Closes #43

See merge request to-be-continuous/golang!76
parents 21e3659e 2f6c0203
Branches
No related tags found
No related merge requests found
...@@ -164,7 +164,7 @@ It is bound to the `build` stage, and uses the following variables: ...@@ -164,7 +164,7 @@ It is bound to the `build` stage, and uses the following variables:
| Input / Variable | Description | Default value | | Input / Variable | Description | Default value |
|-----------------------|----------------------------------------------------------------------------------------------------------|----------------------------------------| |-----------------------|----------------------------------------------------------------------------------------------------------|----------------------------------------|
| `ci-lint-image` / `GO_CI_LINT_IMAGE` | The Docker image used to run `golangci-lint` | `registry.hub.docker.com/golangci/golangci-lint:latest-alpine` <br/>[![Trivy Badge](https://to-be-continuous.gitlab.io/doc/secu/trivy-badge-GO_CI_LINT_IMAGE.svg)](https://to-be-continuous.gitlab.io/doc/secu/trivy-GO_CI_LINT_IMAGE) | | `ci-lint-image` / `GO_CI_LINT_IMAGE` | The Docker image used to run `golangci-lint` | `registry.hub.docker.com/golangci/golangci-lint:latest-alpine` <br/>[![Trivy Badge](https://to-be-continuous.gitlab.io/doc/secu/trivy-badge-GO_CI_LINT_IMAGE.svg)](https://to-be-continuous.gitlab.io/doc/secu/trivy-GO_CI_LINT_IMAGE) |
| `ci-lint-args` / `GO_CI_LINT_ARGS` | `golangci-lint` [command line arguments](https://github.com/golangci/golangci-lint#command-line-options) | `-E gosec,goimports ./...` | | `ci-lint-args` / `GO_CI_LINT_ARGS` | `golangci-lint` [command line arguments](https://github.com/golangci/golangci-lint#command-line-options) | `-E gosec ./...` |
| `ci-lint-disabled` / `GO_CI_LINT_DISABLED` | Set to `true` to disable this job | _none_ (enabled) | | `ci-lint-disabled` / `GO_CI_LINT_DISABLED` | Set to `true` to disable this job | _none_ (enabled) |
In addition to a textual report in the console, this job produces the following reports, kept for one day: In addition to a textual report in the console, this job produces the following reports, kept for one day:
......
...@@ -116,7 +116,7 @@ ...@@ -116,7 +116,7 @@
{ {
"name": "GO_CI_LINT_ARGS", "name": "GO_CI_LINT_ARGS",
"description": "`golangci-lint` [command line arguments](https://github.com/golangci/golangci-lint#command-line-options)", "description": "`golangci-lint` [command line arguments](https://github.com/golangci/golangci-lint#command-line-options)",
"default": "-E gosec,goimports ./...", "default": "-E gosec ./...",
"advanced": true "advanced": true
} }
] ]
......
...@@ -80,7 +80,7 @@ spec: ...@@ -80,7 +80,7 @@ spec:
default: registry.hub.docker.com/golangci/golangci-lint:latest-alpine default: registry.hub.docker.com/golangci/golangci-lint:latest-alpine
ci-lint-args: ci-lint-args:
description: '`golangci-lint` [command line arguments](https://github.com/golangci/golangci-lint#command-line-options)' description: '`golangci-lint` [command line arguments](https://github.com/golangci/golangci-lint#command-line-options)'
default: -E gosec,goimports ./... default: -E gosec ./...
semgrep-image: semgrep-image:
description: The Docker image used to run [Semgrep](https://semgrep.dev/docs/) description: The Docker image used to run [Semgrep](https://semgrep.dev/docs/)
default: registry.hub.docker.com/semgrep/semgrep:latest default: registry.hub.docker.com/semgrep/semgrep:latest
...@@ -719,7 +719,14 @@ go-ci-lint: ...@@ -719,7 +719,14 @@ go-ci-lint:
script: script:
- mkdir -p -m 777 reports - mkdir -p -m 777 reports
# produce all reports at once # 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: artifacts:
name: "$CI_JOB_NAME artifacts from $CI_PROJECT_NAME on $CI_COMMIT_REF_SLUG" name: "$CI_JOB_NAME artifacts from $CI_PROJECT_NAME on $CI_COMMIT_REF_SLUG"
expire_in: 1 day expire_in: 1 day
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment