As part of https://gitlab.com/gitlab-org/gitlab-pages/-/issues/385
we have introduced the use of a custom `.golangci.yml` file with some
custom rules for linting.
This replaces the need of downloading and using `golint`, `gofmt`
`go vet` and `gocyclo` manually. We take advantage of the custom
`golangci-lint` docker image as stated in the [Automatic lintinb]
(https://docs.gitlab.com/ee/development/go_guide/#automatic-linting)
section of the Go standards and style guidelines.
This iteration enables a subset of linters, with the remaining
of them enabled on a separate MR as described in the issue above.
The main changes introduced by this linter include:
- gosec: potential hardcoded credentials
- goconst: DRY by declaring and using constants
- gosimple: reduce statements complexity and improve return statements
For some reason long awk command makes it crash with a
segmentation fault error.
I tested this by replacing $(allfiles) in
`"Please run ./bin/goimports -w -local $(IMPORT_PATH) -l $(allfiles)"`
with strings of various length, and it fails on longer strings.
I haven't yet figured out the source of the problem, so just
copypasted the approach from workhorse - extracted a separate script
which uses if in shell script and echo to print the suggestion.