Skip to content
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

proposal: cmd/go: support build customization with a build.go file #20177

Closed
docbrown opened this issue Apr 29, 2017 · 9 comments
Closed

proposal: cmd/go: support build customization with a build.go file #20177

docbrown opened this issue Apr 29, 2017 · 9 comments

Comments

@docbrown
Copy link

docbrown commented Apr 29, 2017

Having used Rust and Cargo for a bit before coming back to Go for a new project, one thing I really miss is scripted builds. Cargo supports a build.rs file that is compiled and then run to do things like locate native dependencies and generate source files. The output of the build "script" specifies library search paths, compiler options, features (build tags), etc. It would be really great if something similar could be accomplished with Go projects fetched with go get and/or dep. I haven't really thought about the overall design or impact of such a feature, but Cargo's would be a good model to consider.

@mvdan
Copy link
Member

mvdan commented Apr 29, 2017

Similar ideas have been suggested before. I was not successful at finding the ones I remember seeing, but #19849 is a recent example.

The general idea is that go get should not run arbitrary code. See Brad's reply in the thread above.

I also don't think this proposal is detailed enough. What exactly would you do in such a build.go file that you can't currently do with regular Go files and go generate?

Also note that some projects already use custom build systems like make. You only have to stick to go get (or install, etc) if you want your package to be easily and quickly installable.

I don't think I have the authority to decline proposals, so I'll let someone else decide. But I'm fairly sure this was ruled out in the Go design on purpose.

@mvdan mvdan added the Proposal label Apr 29, 2017
@mvdan mvdan added this to the Proposal milestone Apr 29, 2017
@ghost
Copy link

ghost commented Apr 30, 2017

it is related with golang/dep#269
and it reflects golang/dep#269 (comment)

@rsc
Copy link
Contributor

rsc commented May 15, 2017

Blocked on dependency management.

@bcmills
Copy link
Contributor

bcmills commented Jun 15, 2022

Blocked on dependency management.

Dependency management is essentially done at this point, so removing Proposal-Hold.

@seankhliao
Copy link
Member

This also goes against Go's work in supply chain security: https://go.dev/blog/supply-chain

Building code doesn’t execute it
It is an explicit security design goal of the Go toolchain that neither fetching nor building code will let that code execute, even if it is untrusted and malicious.

@ianlancetaylor ianlancetaylor added this to Incoming in Proposals (old) Jun 22, 2022
@rsc
Copy link
Contributor

rsc commented Jun 29, 2022

As noted by @seankhliao this runs directly against the design of Go's dependency management.

@rsc rsc moved this from Incoming to Active in Proposals (old) Jul 1, 2022
@rsc
Copy link
Contributor

rsc commented Jul 1, 2022

This proposal has been added to the active column of the proposals project
and will now be reviewed at the weekly proposal review meetings.
— rsc for the proposal review group

@rsc rsc moved this from Active to Likely Decline in Proposals (old) Jul 13, 2022
@rsc
Copy link
Contributor

rsc commented Jul 13, 2022

Based on the discussion above, this proposal seems like a likely decline.
— rsc for the proposal review group

@rsc rsc moved this from Likely Decline to Declined in Proposals (old) Jul 20, 2022
@rsc
Copy link
Contributor

rsc commented Jul 20, 2022

No change in consensus, so declined.
— rsc for the proposal review group

@rsc rsc closed this as completed Jul 20, 2022
@golang golang locked and limited conversation to collaborators Jul 20, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
No open projects
Development

No branches or pull requests

6 participants