Run golangci-lint only in docker, on every run (closes #55)
check / check (push) Successful in 1m23s
check / check (push) Successful in 1m23s
script/lint builds the new Dockerfile.lint, where golangci-lint runs as a build step. The lint stage is rebuilt on every run, so an unchanged tree is linted too; the module download stays cached. script/bootstrap no longer installs golangci-lint. The Dockerfile lint stage calls golangci-lint directly, since make lint now starts a docker build. golangci-lint config verify is not run: it fetches its schema live over unpinned HTTPS. Model: opus-5-5
This commit is contained in:
+14
-4
@@ -1,14 +1,24 @@
|
||||
#!/bin/sh
|
||||
# script/lint: run the linter.
|
||||
# script/lint: run the linter, in docker only. Builds Dockerfile.lint,
|
||||
# where golangci-lint runs as a build step.
|
||||
#
|
||||
# A cached build lints nothing, so --no-cache-filter rebuilds the lint
|
||||
# stage on every run, an unchanged tree included. It ignores a stage name
|
||||
# that does not exist, so --target names the same stage: a rename then
|
||||
# fails the build instead of serving the lint from cache. cacheonly keeps
|
||||
# no image; only the build's success matters.
|
||||
set -eu
|
||||
|
||||
ROOT="$(cd "$(dirname "$0")/.." && pwd -P)"
|
||||
|
||||
main() {
|
||||
cd "$ROOT"
|
||||
# CGO is required (Makefile exports this too)
|
||||
export CGO_ENABLED=1
|
||||
golangci-lint run --timeout 5m
|
||||
docker build \
|
||||
--progress=plain \
|
||||
--target lint \
|
||||
--no-cache-filter=lint \
|
||||
--output=type=cacheonly \
|
||||
-f Dockerfile.lint .
|
||||
}
|
||||
|
||||
main "$@"
|
||||
|
||||
Reference in New Issue
Block a user