Join GitHub today
cmd/link: delete source file path info in panic‘s stack trace for production releases #13809
see #6819 for original discussion.
Using paths relative to GOROOT or GOPATH seems reasonable. Some benefits are:
Have you tried using GOROOT_FINAL? See the docs at https://golang.org/cmd/go/#hdr-Environment_variables .
I don't have GOROOT set currently. Is there a better doc on how to use both GOROOT and GOROOT_FINAL than that link? I'm unsure on how changing the values will affect my build environment or in what cases it will be used.
Also, if GO is only installed in my user directory, it doesn't look like this will help at all.
$ cat release.sh #!/bin/bash export GOROOT_FINAL=/usr/local/Cellar/go/1.5.1/libexec GOOS=darwin GOARCH=amd64 go build -o execOSX
It still shows my user path. It doesn't appear to accomplish what I was looking for.
referenced this issue
Jan 4, 2016
As I understood @jonjaylward's report, specifically this stack trace:
I believe the objection is to seeing /Users/me/git/go_apps, not to /usr/local/Cellar/go/1.5.1/libexec. (Please correct me if I am wrong.)
The GOROOT_FINAL variable would change /usr/local/Cellar/go/1.5.1/libexec to something else, but it has no effect on code in GOPATH, like /Users/me/git/go_apps/....
As for the request to hide GOPATH in the source file information, we won't remove that by default. It's actually incredibly useful, even in production, to see the full path used to build the software. I certainly want to preserve that.
However, if your local setup is such that removing the GOPATH prefix makes sense, the thing to do is to compile with
That would turn the above stack trace into:
Given this solution I don't think we need to reopen the issue. But I'm happy to do so if I misunderstood the request.