-
Notifications
You must be signed in to change notification settings - Fork 17.8k
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
build: prefix baked-in environment variables with GO_ or similar #38368
Comments
Can you say more about how the Homebrew change broke cgo builds? It's actually fairly standard for |
Homebrew shipped an update to its core that set the Curious: what’s the purpose of baking the path to Edit: if you want to see the carnage: Homebrew/brew#5068 (comment) |
The Homebrew change was that someone set the The argument in this issue is that other build systems may set environment variables like One way to make this less potentially confusing would be to use I think the environment variables that bake in defaults are |
@ydnar For people who aren't distributing their binaries, it's reasonable to permit setting |
@ianlancetaylor agree. Of the variables you mentioned above, which are [paths] used by go or cgo at runtime like |
The ones that are paths are |
Per request here: #38361 (comment)
Currently a
go
binary is built with the value of thePKG_CONFIG
variable as-defined at build-time, and uses that variable to find thepkg-config
binary:https://github.com/golang/go/blob/master/src/make.bash#L53
A coincidental change in Homebrew broke cgo builds for anyone using Homebrew to manage their Go installation.
Given that
pkg-config
is critical for building Go packages with cgo, maybe it makes sense to rename the variable toGO_PKG_CONFIG
so it’s unlikely to be clobbered by upstream build systems. Or, going further, prefix any other environment variables baked into the Go binary withGO
?The text was updated successfully, but these errors were encountered: