Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
cmd/compile: full go file paths produced in .a and bin files even with -trimpath #21720
What version of Go are you using (
changed the title
Full go file paths produced in .a and bin files even with -trimpath
Aug 31, 2017
I think using -trimpath in this manner is unsupported anyway. Currently, we only support setting -trimpath once, and cmd/go already sets it when invoking the compiler and assembler.
Moreover, I believe it's supported for the purpose of trimming temporary directories that are generated during the build, so that repeat builds that use different temporary directories will still produce the same output.
Your intended use case appears to be to hide your $GOPATH directory. I don't think that's a supported use case currently.
/cc @rsc for input on whether this is something we want to support.
I see the same behavior with Go 1.8.3:
@mdempsky My understanding is that all of the strings in the go1.8 case are coming from the c compiler. I forgot to mention in the initial report that I have CGO_CFLAGS="-fdebug-prefix-map=/tmp/my-go-build=/no-such-path". If you set that environment variable or pass the CFLAGS in some other way all references to my-go-build go away in 1.8. In the 1.9 case you still get
What version of Go are you using (go version)?
Does this issue reproduce with the latest release?
What operating system and processor architecture are you using (go env)?
What did you do?
What did you expect to see?
goroutine 1 [running]:
I also noticed that go is creating a temp directory for build process and the command used to compile the binary starts with
/home/dev/Documents/iox/go/pkg/tool/linux_amd64/compile -o $WORK/ioxclient.a -trimpath $WORK -trimpath=/home/dev/Documents/iox/proj/
Is it failing because trimpath can only be used once to remove $WORK?