fleetlint Policy for a fleet of repositories
v0.11 (latest)
Getting started

repo/toolchain-pinned/go

Toolchain version is pinned

Implements repo/toolchain-pinned for go.

Severitywarning
Tiers1, 2
Stacksgo
Scopeeach
Kindexpr
Sourcelibrary v0.8.0
Selected byfleetlint-recommended@v0.8.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 or devbox.json names go with a version. In devbox.json the package needs a version (go@1.27.4); @latest does not count.

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))
|| ["", "../", "../../", "../../../"].exists(d, file(d + "devbox.json") && text(d + "devbox.json").matches(r'"(go)(@v?\d|"\s*:\s*("v?\d|\{[^}]*"version"\s*:\s*"v?\d))|"(go_\d+_\d+)(@[^"]*)?"'))

Fix

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

Agent instruction (from repo/toolchain-pinned): Add the stack’s toolchain pin set to the version currently installed; do not upgrade the toolchain in the same change.

A finding that names no file points at go.mod.

Sources


Generated by fleetlint docs from catalog v0.8.0.