Skip to content

go-lint

golangci-lint run over the project's Go packages, on the consolidated go-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/**. CHANGELOG.md is deliberately not in the default changes: a colophon release MR fast-forwards a changelog-only commit onto a main that every merge already tested, so linting again there re-proves the same tree. It was included from 2026-07-23 to 2026-09-03 for releaser-pleaser's bootstrap case — see spec 0051 and its reversal in spec 0079 D3.

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.

Caching

On a runner that mounts a shared Go cache at /opt/go-cache (runner1 does, spec 0079 D7), the job points GOMODCACHE, GOCACHE and GOLANGCI_LINT_CACHE there in its before_script and shares one module and build cache with every Go job on the box; the per-project GitLab cache: below then archives empty directories. Without the mount the GitLab cache applies as before. If you override before_script, carry that detection across, or the job falls back to its per-project cache.

Inputs

Input Type Default Description
image string go-tools:v0.5.0 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. CHANGELOG.md is deliberately absent (spec 0079 D3).

Usage

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

See also