All checks were successful
check / check (push) Successful in 2m42s
golangci-lint no longer runs on the host. script/lint builds
Dockerfile.lint, which copies the repo into the digest-pinned
golangci-lint image and lints as a build step, so a successful build is
a clean lint. The host binary shared one cache and one lock with every
other checkout on the machine, which produced findings attributed to
unrelated worktrees as well as unearned passes.
Three properties the wrapper has to get right:
- --no-cache-filter=lint forces the lint stage to re-execute. Without
it an unchanged tree replays the layer and the build exits 0 in under
a second having linted nothing. The deps stage stays cacheable.
- docker silently ignores --no-cache-filter when the stage name does
not match, so the flag alone is a convention, not a guarantee: a
rename or a typo restores the cached false green with no warning.
script/lint therefore tees the build output and fails unless
golangci-lint's own summary line ("N issues." / "N issues:") appears
in it. No summary, no lint, whatever the exit code says.
- Both lint steps use RUN --network=none. golangci-lint config verify
is documented as fetching its JSON schema over HTTPS; the pinned
image resolves it with no network, and --network=none enforces that
rather than trusting it. Verify is kept because golangci-lint run
silently ignores config keys it does not recognize.
The main Dockerfile's lint stage now invokes golangci-lint directly
instead of `make lint`, which would otherwise need a docker daemon
inside the build.
golangci-lint installation is removed from script/bootstrap. Its curl
guard and its script/fetch-assets call are untouched.
3.8 KiB
3.8 KiB