deps/locked-install/go
Installs use the lockfile strictly
Implements deps/locked-install for go.
| Severity | warning |
| Tiers | 1, 2 |
| Stacks | go |
| Scope | each |
| Kind | expr |
| Source | library v0.8.0 |
| Selected by | fleetlint-recommended@v0.8.0 |
Requirement
Go verifies every download against go.sum and, since Go 1.16, refuses to change go.mod during a build (-mod=readonly); this holds unless a recipe or CI step passes -mod=mod (or sets it in GOFLAGS), which is what is checked.
Why
An install that quietly re-resolves builds and tests something other than what the lockfile in git says, and the drift shows up only in production.
Check
!(taskrunner.recipes.filter(t, !t.matches(r'(?i)update|upgrade|lock|bump|renovate')).map(t, taskrunner.recipes[t]).flatten()
+ workflows().map(w, steps(w).map(s, s.run.split("\n")).flatten()).flatten())
.filter(l, !l.matches(params.noise)).exists(l, l.matches(r'-mod[= ]mod\b'))
&& !workflows().exists(w, text(w).matches(r'GOFLAGS:[^\n]*-mod=mod'))Parameters
noise:^\s*[@+-]*\s*(\{\{[^}]*\}\}\s*|\$[({][A-Za-z_]+[)}]\s*)?(#|//|echo\b|printf\b)
Fix
Drop -mod=mod; run go mod tidy and commit go.mod and go.sum instead.
Agent instruction (from deps/locked-install): Switch the CI and task-runner installs to the package manager’s locked mode; if that fails, regenerate the lockfile in a separate commit rather than relaxing the install.
Sources
- https://github.com/ossf/scorecard/blob/main/docs/checks.md (standard, Pinned-Dependencies)
- https://fleetlint.org/baseline/#dependencies (convention)
- https://go.dev/ref/mod (spec, Build commands)
- https://fleetlint.org/stacks/#go
Generated by fleetlint docs from catalog v0.8.0.