Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upcmd/go: add test for build -a -tags netgo -installsuffix netgo in test.bash #9369
Comments
ianlancetaylor
added
the
repo-main
label
Dec 17, 2014
ianlancetaylor
added this to the Go1.4.1 milestone
Dec 17, 2014
This comment has been minimized.
This comment has been minimized.
|
I propose that we allow go build -a std to rebuild everything in std, One interesting observation is that, with 1.4,
|
This comment has been minimized.
This comment has been minimized.
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.
|
This comment has been minimized.
This comment has been minimized.
|
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 |
This comment has been minimized.
This comment has been minimized.
tianon
commented
Dec 19, 2014
|
Given a source release, is there a way to compile in It was discovered that |
mikioh
referenced this issue
Dec 20, 2014
Closed
cmd/go: With Go 1.4, cannot statically link a program which imports net #9344
This comment has been minimized.
This comment has been minimized.
kostix
commented
Dec 21, 2014
|
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 |
This comment has been minimized.
This comment has been minimized.
|
Does |
This comment has been minimized.
This comment has been minimized.
No. it will reinstall the following packages along with all non-standard cmd/internal/rsc.io/arm/armasm |
This comment has been minimized.
This comment has been minimized.
|
No, adding std causes the standard programs to be reinstalled but does not cause the standard library to be rebuilt. |
This comment has been minimized.
This comment has been minimized.
|
To be clear, my "no" was in reply to adg, not minux. |
This comment has been minimized.
This comment has been minimized.
|
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. |
This comment has been minimized.
This comment has been minimized.
|
I like that plan.
|
This comment has been minimized.
This comment has been minimized.
|
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 |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
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. |
This comment has been minimized.
This comment has been minimized.
|
I imagine that negation only works for explicitly listed packages (or Whether -i applies to negated packages or not is open to debate, though. |
This comment has been minimized.
This comment has been minimized.
|
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:
|
This comment has been minimized.
This comment has been minimized.
|
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 |
This comment has been minimized.
This comment has been minimized.
|
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:
|
This comment has been minimized.
This comment has been minimized.
|
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 |
This comment has been minimized.
This comment has been minimized.
|
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:
|
This comment has been minimized.
This comment has been minimized.
|
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 |
This comment has been minimized.
This comment has been minimized.
|
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:
|
This comment has been minimized.
This comment has been minimized.
|
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 |
This comment has been minimized.
This comment has been minimized.
|
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:
|
This comment has been minimized.
This comment has been minimized.
|
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 |
This comment has been minimized.
This comment has been minimized.
|
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. |
This comment has been minimized.
This comment has been minimized.
tianon
commented
Jan 14, 2015
Ahh, I can confirm that this works for my smaller project that needed this. Going to test it on Docker shortly too. |
tianon
referenced this issue
Jan 14, 2015
Merged
Add proper "netgo" compiling, thanks to rsc ♥ #10087
This comment has been minimized.
This comment has been minimized.
tianon
commented
Jan 14, 2015
|
It works! Any chance we could get that in a test case to make sure it doesn't break for Go 1.5? |
rsc
modified the milestones:
Go1.5,
Go1.4.1
Jan 14, 2015
rsc
changed the title
cmd/go: provide some way to build programs with net package built with -tags netgo
cmd/go: add test for build -a -tags netgo -installsuffix netgo in test.bash
Jan 14, 2015
krnowak
added a commit
to endocode/goaci
that referenced
this issue
Feb 18, 2015
krnowak
added a commit
to endocode/goaci
that referenced
this issue
Feb 18, 2015
krnowak
added a commit
to endocode/goaci
that referenced
this issue
Feb 18, 2015
krnowak
added a commit
to endocode/goaci
that referenced
this issue
Feb 19, 2015
rsc
removed
the
repo-main
label
Apr 14, 2015
bboreham
referenced this issue
May 26, 2015
Open
Makefile should use -installsuffifx in addition to -netgo #742
This comment has been minimized.
This comment has been minimized.
gopherbot
commented
Jun 5, 2015
|
CL https://golang.org/cl/10761 mentions this issue. |
ianlancetaylor commentedDec 17, 2014
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.