Skip to content

go-lint

golangci-lint run over the project's Go packages, on the consolidated dev-tools image (which bakes golangci-lint + Go). Reads .golangci.yml (or .golangci.toml, etc.) from the project root. MR-only by default; override if: to widen or narrow the gate.

Change-detected by default. Embed projects with a Svelte UI (see Explanation: the Svelte frontend track) should extend changes with their frontend path, e.g. pkg/studio/web/**.

Jobs

Job What it runs
golangci-lint golangci-lint run --timeout=$[[ inputs.timeout ]] $[[ inputs.paths ]], with a stable ${CI_PROJECT_PATH_SLUG}-go-keyed cache for .go/pkg/mod and .go/cache.

Inputs

Input Type Default Description
image string dev-tools:v0.1.2 Image to run golangci-lint in. Override with e.g. golangci/golangci-lint:vX.Y to pin a specific upstream.
stage string lint GitLab CI stage.
timeout string "30m" Value passed to golangci-lint run --timeout=.
paths string "./..." Go path expression(s), space-separated.
if string '$CI_PIPELINE_SOURCE == "merge_request_event"' Gating rules:if: expression.
changes array ["**/*.go", "**/go.mod", "**/go.sum", ".golangci.*", ".gitlab-ci.yml"] Change-detection paths. Extend with a frontend path for embed projects; set ["**/*"] to always run.

Usage

include:
  - component: gitlab.com/phpboyscout/cicd/[email protected]

See also