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: go build should build multiple main packages #23616

Closed
rasky opened this issue Jan 30, 2018 · 9 comments
Closed

proposal: cmd/go: go build should build multiple main packages #23616

rasky opened this issue Jan 30, 2018 · 9 comments
Labels
FrozenDueToAge NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made. Proposal
Milestone

Comments

@rasky
Copy link
Member

rasky commented Jan 30, 2018

go help build says:

When compiling multiple packages or a single non-main package,
build compiles the packages but discards the resulting object,
serving only as a check that the packages can be built.

The fact that go build doesn't build is counter-intuitive. It would be great to change it to generate binaries (just like it does when a single package is specified). Especially now with the build cache, it doesn't sound too much of a burden, and it would further reduce cases where an external build system is required.

@ianlancetaylor ianlancetaylor added the NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made. label Jan 30, 2018
@ianlancetaylor ianlancetaylor added this to the Go1.11 milestone Jan 30, 2018
@ianlancetaylor
Copy link
Contributor

I guess we would have to prohibit the -o option in that case. Would it just put all the executables in the current directory?

@rasky
Copy link
Member Author

rasky commented Jan 30, 2018

-o is already prohibited for multiple packages:

The -o flag, only allowed when compiling a single package,
forces build to write the resulting executable or object
to the named output file, instead of the default behavior described
in the last two paragraphs.

Probably, putting all files into the current directory is the least surprising solution, and it's also compatible with how go build behaves with a single package.

@rasky
Copy link
Member Author

rasky commented Feb 10, 2018

I would attempt a patch, but I think it needs decision first... @rsc?

@rasky
Copy link
Member Author

rasky commented Mar 6, 2018

@rsc I would like to implement this, but can you please ack on the general idea first?

@rasky
Copy link
Member Author

rasky commented Apr 2, 2018

Ping @rsc @bradfitz @andybons ... should I just go and implement it?

@bradfitz
Copy link
Contributor

bradfitz commented Apr 2, 2018

IIRC (away from corp laptop), many people on the Go team are out this week, so the weekly NeedsDecision meeting will likely not happen today, and this needs @rsc's decision.

You could implement it now if you want, but @rsc might decide against it later.

@ianlancetaylor ianlancetaylor modified the milestones: Go1.11, Go1.12 Jul 6, 2018
@rasky
Copy link
Member Author

rasky commented Jul 24, 2018

Ping @rsc

@andybons andybons changed the title cmd/go: go build should build multiple main packages proposal: cmd/go: go build should build multiple main packages Jul 25, 2018
@andybons
Copy link
Member

Bumping to proposal so this will get looked at during our next meeting.

@rsc
Copy link
Contributor

rsc commented Aug 13, 2018

Duplicate of #14295, which I commented on last week. I think this should just work. #14295 (comment)

@rsc rsc closed this as completed Aug 13, 2018
@golang golang locked and limited conversation to collaborators Aug 13, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made. Proposal
Projects
None yet
Development

No branches or pull requests

6 participants