fleetlint Policy for a fleet of repositories
v0.5
Getting started

repo/toolchain-pinned/go

Toolchain version is pinned

Implements repo/toolchain-pinned for go.

Severitywarning
Tiers1, 2
Stacksgo
Scopeeach
Kindexpr
Sourcelibrary v0.2.0
Selected byfleetlint-recommended@v0.2.0

Requirement

go.mod (or the go.work of a parent workspace) has a toolchain directive or a full go 1.x.y version, or .tool-versions/mise names go with a version.

Why

Without a pin, every machine and every CI run builds with whatever compiler or runtime happens to be installed, and failures cannot be reproduced.

Check

scan("go.mod", r'^(toolchain go\d+\.\d+|go \d+\.\d+\.\d+)').size() > 0 || ["../", "../../", "../../../"].exists(d, file(d + "go.work") && scan(d + "go.work", r'^(toolchain go\d+\.\d+|go \d+\.\d+\.\d+)').size() > 0) || ["", "../", "../../", "../../../"].exists(d, file(d + ".tool-versions") && scan(d + ".tool-versions", r'^\s*(go|golang)\s+\S*\d').size() > 0) || ["", "../", "../../", "../../../"].exists(d, ["mise.toml", ".mise.toml", ".config/mise.toml", ".config/mise/config.toml", "mise/config.toml"].exists(n,
     file(d + n) && scan(d + n, r'^\s*"?(go|golang)"?\s*=\s*[^#\n]*\d').size() > 0))

Fix

Set go 1.x.y (or a toolchain go1.x.y line) in go.mod.

Agent instruction: Add the stack’s toolchain pin set to the version currently installed; do not upgrade the toolchain in the same change.

See: https://fleetlint.org/baseline/#hygiene, https://fleetlint.org/stacks/, https://fleetlint.org/stacks/#go


Generated by fleetlint docs from catalog v0.2.0.