ci: update automatic linting and fix issues
Context
The static-analysis
job runs the golangci-lint
linter. The job uses the old image registry.gitlab.com/gitlab-org/gitlab-build-images:golangci-lint-alpine
which was deprecated in %16.10.
Problem
The linter job has been silently failing because we have a condition set as -issues-exit-code 0
, for example https://gitlab.com/gitlab-org/container-registry/-/jobs/7380948519
Solution
-
Update the linter image to use the upstream version of golangci-lint
-
Make the static-analysis
pass on failure temporarilyallow_failure: true
-
Fix linting issues in small MRs to make reviews smaller and easy to follow -
Once all issues have been fixed, remove the allow_failure
flag from the job
Linters
Linter | MR | Who |
---|---|---|
unused | !1879 (merged) | @jaime |
gosimple | !1864 (merged) | @jaime |
staticcheck | !1757 (merged) | @jaime |
gofumpt | !1710 (merged) | @jaime |
depguard | !1695 (merged) | @jaime |
govet | !1902 (merged) | @jaime |
stylecheck | !1913 (merged) | @vespian_gl |
nakedret | !1909 (merged) | @vespian_gl |
whitespace | !1910 (merged) | @vespian_gl |
ineffassign | !1907 (merged) | @vespian_gl |
unparam | !1903 (merged) | @jaime |
revive | !1927 (merged) .... | @vespian_gl |
gosec | !1923 (merged) !1922 (merged) | @vespian_gl |
Edited by Jaime Martinez