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: -x flag does not produce executable output #9052

davecheney opened this Issue Nov 3, 2014 · 2 comments


None yet
4 participants

davecheney commented Nov 3, 2014

dfc@qnap:~$ go build -x os/user
mkdir -p $WORK/os/user/_obj/
mkdir -p $WORK/os/
cd /home/dfc/go/src/os/user
CGO_LDFLAGS="-g" "-O2" /home/dfc/go/pkg/tool/linux_arm/cgo -objdir
$WORK/os/user/_obj/ -- -I $WORK/os/user/_obj/ lookup_unix.go
** SNIP *

The key is the assignment to CGO_LDFLAGS should be ="-g -O2", but is
incorrectly '-g", "-O2" which will cause the shell to look for a command,

$ CGO_LDFLAGS="-g" "-O2" /home/dfc/go/pkg/tool/linux_arm/cgo -objdir
$WORK/os/user/_obj/ -- -I $WORK/os/user/_obj/ lookup_unix.go
-bash: -O2: command not found

This comment has been minimized.


ianlancetaylor commented Nov 3, 2014

Comment 1:

Labels changed: added repo-main, release-go1.5.

@davecheney davecheney added new labels Nov 3, 2014

@bradfitz bradfitz modified the milestone: Go1.5 Dec 16, 2014

@rsc rsc removed the repo-main label Apr 14, 2015

@rsc rsc changed the title from cmd/go: -x flag does not produce reproducible output to cmd/go: -x flag does not produce executable output Apr 20, 2015


This comment has been minimized.


rsc commented Jun 8, 2015

go build -x is not about producing an exact shell script. This kind of bug has been filed before (maybe about dist?), but of course it depends on the quoting rules of the shell and more. I'm not terribly inclined to try to shove those rules into cmd/go. If you want to use %q that's fine, but it still won't be shell input.

@rsc rsc modified the milestones: Unplanned, Go1.5 Jun 8, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment