-
-
Notifications
You must be signed in to change notification settings - Fork 12.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Go: don't set GOTOOLCHAIN=local #202030
Comments
Does doing |
Yes it does (or rather, I've used |
Per the
so formulae build constraints aren't really relevant here (even if you are correct to suggest that we do want |
That refers to brew-installed tools? It doesn't seem to make much sense to impose this restriction on local dev work. It feels (no pun intented!) that the real suggestion here it to use brew Go only as far as it's required for other formulas but switch to go.dev-downloaded go for local dev work. |
See #202030 and golang/go#70949. In particular, our current `go.env` contains # Automatically download newer toolchains as directed by go.mod files. # See https://go.dev/doc/toolchain for details. GOTOOLCHAIN=local The comment about automatically downloading newer toolchains applies only whenever `GOTOOLCHAIN=auto`, but we change that to `GOTOOLCHAIN=local`. Therefore, let's get rid of the comment that no longer applies after our `GOTOOLCHAIN` change.
Yes.
You could do that. You could also configure |
It isn't once you understand what's happening. It just seems to me that setting this locally also defeats the purpose of the original setting regarding self-updating tools. So it's really a no-op to have this in the first place? |
That argument holds only if every user of the Go formula sets |
Obviously not. But if users do so to retain standard go behaviour it does. So imho it makes the use of it as part of the Go formula instead of the Go-dependent formulas brittle. |
In that case I'm not persuaded that it's a no-op. It's certainly a no-op sometimes, if a user decides to override it. But it being sometimes a no-op is nowhere near as strong a reason to switch back to setting At this stage I'm not convinced we have good reasons to change this default given that:
But I'll tag @Homebrew/core here in case someone else has a different opinion. |
I don't have strong feelings either way now that I'm aware of it. I can imagine though that- although caveat documented- this may be overlooked by other users, too. If that can be prevented by enforcing the policy in a better way that would imho be preferred over unexpected changed to the Go standard. Thanks for looking into this! |
See Homebrew#202030 and golang/go#70949. In particular, our current `go.env` contains # Automatically download newer toolchains as directed by go.mod files. # See https://go.dev/doc/toolchain for details. GOTOOLCHAIN=local The comment about automatically downloading newer toolchains applies only whenever `GOTOOLCHAIN=auto`, but we change that to `GOTOOLCHAIN=local`. Therefore, let's get rid of the comment that no longer applies after our `GOTOOLCHAIN` change.
I agree with this reasoning 👍🏻 |
If there was another mechanism for ensuring that formulas keep being compiled with the Go toolchain version that comes with the formula than the current one (non-standard go.env), and that mechanism did not impose not updating Go toolchains outside of formula usage, would you prefer such a mechanism over the current one? |
From the brew maintainer's perspective it feels ok to use predictable, prescribed Go version to build a formulae and that can really be up to the maintainers to agree up on, as it generally should not affect the programs for end users to notice at all. But from Go developer's perspective this changes the Go's behaviour and can be seen as breaking it, changing it compared to what would be installed from the official Go release channels, changing it for end users (Go developers). |
I guess the main point to me is: are you wanting to use Homebrew Go or upstream Go? If it's Homebrew Go then you need We aren't the only package manager to do this. I checked a random few and Alpine, CentOS, Fedora and Gentoo all change the default. Debian however notably don't do anything yet but have considered |
Not sure what this means. I can use brew go and do
and it will happily download other toolchains (from go.dev) as required by go.mod. This is enough to compile non-brew software that requires a different toolchain version.
You don‘t afaiu. The main point for brew Go for me is that I can always have bleeding edge Go along with updates for anything else using brew. |
Hello! I would like to plead for you not to disable the GOTOOLCHAIN mechanism. First, I would argue it's very different from a self-update mechanism: the Go install in the Cellar doesn't change, and if you Second, it's very useful. Go is all about self-contained builds, and fetching the compiler if needed is a wonderful user experience. It even carries into VS Code: you can change the go.mod line and boom, new version within that module. Disabling it here turns all that off :( Third, turning it off is kinda confusing. I would say I am more familiar with Go and Homebrew than the average user, and it took me quite a bit to figure out what was going on here. I think partially this is because Homebrew delightfully got me used to expecting the upstream defaults, unlike the heavyhanded approach of some distributions, so it took me a while before I realized what could be going on. Thank you for listening ✨ |
I didn't realise this, thanks for explaining @FiloSottile.
This sounds pretty similar to how e.g.
This is something we aim for. Given all this:
I no longer agree and think it'd be nicer to unset |
brew gist-logs <formula>
link ORbrew config
ANDbrew doctor
outputVerification
brew doctor
output saysYour system is ready to brew.
and am still able to reproduce my issue.brew update
and am still able to reproduce my issue.brew doctor
and that did not fix my problem.What were you trying to do (and why)?
Coming from golang/go#70949 where Go fails to install newer toolchain for compiling module. This is due to https://github.com/Homebrew/homebrew-core/blob/master/Formula/g/go.rb#L93. While this may be the right setting for compiling brew formulas, it breaks using Go for other purposes.
What happened (include all command output)?
What did you expect to happen?
Go 1.23 downloads Go 1.24 and compiles successfully.
Step-by-step reproduction instructions (by running
brew
commands)The text was updated successfully, but these errors were encountered: