Make sure to build godoclint with the correct version of go#289
Conversation
stefanvanburen
left a comment
There was a problem hiding this comment.
surprised we haven't been bitten by this before, but makes sense to me - I think we can land this, but we probably ought to port it to the other go install'd deps (at least golangci-lint and govulncheck that may be influenced by the built toolchain version)? happy to do that in a follow-up if you'd like.
|
@stefanvanburen, good call! The But |
|
thanks! |
I happened to have go1.25.1 downloaded, and newer stuff works (like modules that require 1.26) because of the automatic download and use of other toolchains.
However, when you do
go install ...@<version>of a package or command that is not in the current module nor its dependencies, it does not use the toolchain indicated ingo.mod. Instead, it just uses the toolchain that is actually on the path.So this was touching a file with "go1.26" in the name, to indicate that it had downloaded and built a version ostensibly for go1.26. But it was actually being built with go1.25.1 and generating errors because it doesn't like the mismatch of Go minor versions.
The fix is to force the
go installstep to use a particular toolchain, which can be done using theGOTOOLCHAINenvironment variable. I tried this out (after deleting the version file that a prior had hadtouched) and it worked to fix my issues. I also played with it a bit in this repo, to make sure it would always do the right thing after editing the version ingo.mod.