Skip to content

Go version detection and Go hook install use different effective toolchains #1796

Description

@deadnews

Summary

Issue #987 was closed by #1457.

This still reproduces in GitHub Actions with prek v0.3.5.

Repro: https://github.com/deadnews/deadnews-template-go/actions/runs/23120666156/job/67154009547?pr=167

Hook: golangci/golangci-lint@v2.11.3

Observed

The workflow shows:

which go
/usr/bin/go

GOTOOLCHAIN=local /usr/bin/go version
go version go1.24.13 linux/amd64

GOTOOLCHAIN=local go version
go version go1.24.13 linux/amd64

/usr/bin/go version
go: downloading go1.26.0 (linux/amd64)
go version go1.26.0 linux/amd64

go version
go version go1.26.0 linux/amd64

prek then logs:

TRACE Using go.mod-derived language_version hook=golangci-lint-full version=>= 1.25.0
TRACE Found matching system go go=/usr/bin/go@1.26.0
TRACE Using system go go=/usr/bin/go@1.26.0

The hook install still fails with:

go: go.mod requires go >= 1.25.0 (running go 1.24.13; GOTOOLCHAIN=local)

Expected

Go version detection and Go hook installation should use the same effective toolchain behavior.

Actual

Go version detection sees /usr/bin/go as 1.26.0, but hook installation runs with GOTOOLCHAIN=local and the same /usr/bin/go is effectively 1.24.13.

Related

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions