You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
On my OSX machine I ran: env GOOS=linux GOARCH=amd64 go build
Then I copied the binary to an Ubuntu machine and executed it:
ubuntu@machine:~$ uname -a
Linux machine 3.13.0-53-generic #89-Ubuntu SMP Wed May 20 10:34:39 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
ubuntu@machine:~$ ./golang_err
What did you expect to see? &{1000 1000 ubuntu Ubuntu /home/ubuntu} <nil>
What did you see instead? <nil> user: Current not implemented on linux/amd64
If I compile the code directly on the linux machine with the version go version go1.5beta2 linux/amd64, then it works correctly. This leads me to think that it is related to the cross compilation.
If the functionality is not to be implemented in 1.5 and it can be detected at compilation time, I would suggest that a warning/error is shown to the user in order to prevent deploying binaries that will break in production due to this issue.
It is also possible that I may have missed any reference to it in the documentation, but if this is a know or "works as designed" behaviour, I'd recommend making it more visible.
The text was updated successfully, but these errors were encountered:
The os/user package relies on cgo. To cross-compile it, you need to say
CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build
You will need to have a Darwin -> GNU/Linux cross-compiler installed. You probably also need to set the CC environment variable to point to that cross-compiler.
This is working as expected, so I'm going to close this issue.
mikioh
changed the title
os/user 1.5 beta 2
os/user: doesn't work when CGO_ENABLED=0
Jul 21, 2015
go version go1.5beta2 darwin/amd64
OSX Yosemite 10.10.4
The problem can be reproduced by trying to cross compile the following code from darwin/amd64 to linux/amd64
On my OSX machine I ran:
env GOOS=linux GOARCH=amd64 go build
Then I copied the binary to an Ubuntu machine and executed it:
&{1000 1000 ubuntu Ubuntu /home/ubuntu} <nil>
<nil> user: Current not implemented on linux/amd64
If I compile the code directly on the linux machine with the version
go version go1.5beta2 linux/amd64
, then it works correctly. This leads me to think that it is related to the cross compilation.If the functionality is not to be implemented in 1.5 and it can be detected at compilation time, I would suggest that a warning/error is shown to the user in order to prevent deploying binaries that will break in production due to this issue.
It is also possible that I may have missed any reference to it in the documentation, but if this is a know or "works as designed" behaviour, I'd recommend making it more visible.
The text was updated successfully, but these errors were encountered: