diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-12-19 21:07:48 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-12-19 21:07:48 +0300 |
commit | b5571e6e22cdacc81f78eff5943d68c8ba220fbb (patch) | |
tree | 3677b792f5afe0b4853cee59e166df961993b7e8 /doc/development/go_guide | |
parent | f92a53a216e6e7d5037ac701efbee5628f91aa9a (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'doc/development/go_guide')
-rw-r--r-- | doc/development/go_guide/index.md | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/doc/development/go_guide/index.md b/doc/development/go_guide/index.md index 724bc240bc2..f6aae945f62 100644 --- a/doc/development/go_guide/index.md +++ b/doc/development/go_guide/index.md @@ -78,13 +78,27 @@ projects: All Go projects should include these GitLab CI/CD jobs: ```yaml -go lint: - image: golang:1.11 +lint: + image: registry.gitlab.com/gitlab-org/gitlab-build-images:golangci-lint-alpine + stage: test script: - - go get -u golang.org/x/lint/golint - - golint -set_exit_status $(go list ./... | grep -v "vendor/") + # Use default .golangci.yml file from the image if one is not present in the project root. + - '[ -e .golangci.yml ] || cp /golangci/.golangci.yml .' + # Write the code coverage report to gl-code-quality-report.json + # and print linting issues to stdout in the format: path/to/file:line description + - golangci-lint run --out-format code-climate | tee gl-code-quality-report.json | jq -r '.[] | "\(.location.path):\(.location.lines.begin) \(.description)"' + artifacts: + reports: + codequality: gl-code-quality-report.json + paths: + - gl-code-quality-report.json + allow_failure: true ``` +Including a `.golangci.yml` in the root directory of the project allows for +configuration of `golangci-lint`. All options for `golangci-lint` are listed in +this [example](https://github.com/golangci/golangci-lint/blob/master/.golangci.example.yml). + Once [recursive includes](https://gitlab.com/gitlab-org/gitlab-foss/issues/56836) become available, you will be able to share job templates like this [analyzer](https://gitlab.com/gitlab-org/security-products/ci-templates/raw/master/includes-dev/analyzer.yml). |