tools/bump: read the toolchain with GOTOOLCHAIN=local

go env GOVERSION reports the toolchain the go command switched to, so a
go.mod that had outrun nixpkgs read back as a nixpkgs that had caught
up, and checkToolchain compared 1.27.1 against itself.
This commit is contained in:
Kristoffer Dalby
2026-09-04 15:02:59 +00:00
parent c7a7ea20ce
commit d33ed80c41
+7 -2
View File
@@ -119,9 +119,14 @@ func gateFlake(ctx context.Context, r *repo) error {
return err
}
// goVersion is the Go the devShell now provides, without the "go" prefix.
// goVersion is the Go the devShell provides, without the "go" prefix.
//
// GOTOOLCHAIN=local is not optional here. Left to itself the go command
// switches to whatever go.mod asks for and reports that instead, so a go.mod
// that has outrun nixpkgs looks like a nixpkgs that has caught up, and the one
// check that would have noticed compares a value against itself.
func goVersion(ctx context.Context, r *repo) (string, error) {
out, err := r.nixRun(ctx, "go", "env", "GOVERSION")
out, err := r.nixRun(ctx, "env", "GOTOOLCHAIN=local", "go", "env", "GOVERSION")
if err != nil {
return "", err
}