-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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
cmd/go: add test for build -a -tags netgo -installsuffix netgo in test.bash #9369
Comments
I propose that we allow go build -a std to rebuild everything in std, One interesting observation is that, with 1.4,
|
Maybe we should just roll back the change to -a. It wasn't working before, but then as now, the REAL fix is to build go from source.
|
I'd argue that it's not a new special case. The original fix is a special case, and Yes, this might encourage people to use go build, but sometimes people just Also, I'm among the one that oppose that fix. I think a better solution for #8290 |
Given a source release, is there a way to compile in It was discovered that |
Is there a way to make Please note that I'm not familiar with Go internals, just conveying what would seem to be logical to a layman. I mean, until the 1.4 release I had no idea that building a Linux binary with "static DNS lookups" (via |
Does |
No. it will reinstall the following packages along with all non-standard cmd/internal/rsc.io/arm/armasm |
No, adding std causes the standard programs to be reinstalled but does not cause the standard library to be rebuilt. |
To be clear, my "no" was in reply to adg, not minux. |
We used to have a simple rule: the build flag -a meant to rebuild all packages even if they were up to date. We made that flag more complicated by changing it to ignore standard packages for a release build. I propose that we restore -a to what it used to be, and add a new flag to ignore standard packages. Advantages: 1) fixes the original issue by giving people a flag to do what they want; 2) fixes this issue; 3) simplifies the meaning of -a. Cons: New flag. |
I like that plan.
|
Could we just support package negation on the cmd/go command line? yes, this is more work, but it's also a new general capability that could And then we can restore the -a flag, and advise people of binary Rationale for this is that no only std packages need special treatment, go install -a all -std -golang.org/x/tools/cmd/{godoc,cover,vet} Have this general mechanism will save us the trouble should we introduce |
I think that negating the list of packages may become more complex when discussing "go build -i". It's also odd in that it only really applies to all or "....". But I'd be OK with that if people prefer it. |
I imagine that negation only works for explicitly listed packages (or Whether -i applies to negated packages or not is open to debate, though. |
I'd really like to see the behaviour of -a reverted for Go 1.4.1 Once that is done we can workshop more elaborate ideas for Go 1.5. What I don't want to see is users of Go 1.4 have to wait 8 months for a On Wed, Jan 7, 2015 at 12:49 PM, Minux Ma notifications@github.com wrote:
|
A more conservative stop-gap solution for 1.4.1 might be that The rationale being that the user should rarely need netgo, so If the user want to use pure Go net package always, they can |
I think reverting the change which affected the behaviour of -a is the most On Wed, Jan 7, 2015 at 1:21 PM, Minux Ma notifications@github.com wrote:
|
I agree (to revert that change in 1.4.1). That change is not fully $ go14 version And go install -a all will still try to reinstall |
If the problem to be solved is "how can I rebuild my $GOPATH after
That will work. In the rare case of multiple GOPATH entries, the procedure I don't know why anyone would need to do this anyway. On Wed, Jan 7, 2015 at 1:31 PM, Minux Ma notifications@github.com wrote:
|
On Tue, Jan 6, 2015 at 9:36 PM, Dave Cheney notifications@github.com
I agree. Building Go code is generally so fast that even rebuilding |
I don't know what you mean by 'every time', if you mean every time you On Wed, Jan 7, 2015 at 1:42 PM, Minux Ma notifications@github.com wrote:
|
On Tue, Jan 6, 2015 at 9:45 PM, Dave Cheney notifications@github.com
A concrete example for what I meant by "every time". Because I don't have any cgo packages in that GOPATH, I don't feel |
Why would you do something like this ? Is it just for testing ? This doesn't sound like a use case that the go tool should be optimising On Wed, Jan 7, 2015 at 1:52 PM, Minux Ma notifications@github.com wrote:
|
As mentioned in the CL (https://golang.org/cl/2770), I'm in favor For those who want to install a netgo package, they do have a As they are installing into $GOROOT anyway, touching the net |
The original report was not 'go install', it was 'go build'. Specifically, 'go build -a -tags netgo my/binary' doesn't work anymore. I believe the correct response to is to use 'go build -a -tags netgo -installsuffix netgo my/binary'. That command should work fine in plain Go 1.4, no changes needed right now. |
Ahh, I can confirm that this works for my smaller project that needed this. Going to test it on Docker shortly too. 👍 ❤️ |
It works! 🎉 (moby/moby#10087) Any chance we could get that in a test case to make sure it doesn't break for Go 1.5? 👼 |
CL https://golang.org/cl/10761 mentions this issue. |
In Go 1.4 we changed "go build -a" so that it no longer builds the standard library (issue #8290). Prior to Go 1.4, programmers who wanted a fully static binary that uses the network routinely built their programs with "go build -a -tags netgo". That no longer works. There is no longer a simple way do achieve this desirable goal. We should fix this for 1.4.1.
The text was updated successfully, but these errors were encountered: