Skip to content
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

question: How to remove directory information? #39035

Closed
Techno-Fox opened this issue May 13, 2020 · 1 comment
Closed

question: How to remove directory information? #39035

Techno-Fox opened this issue May 13, 2020 · 1 comment

Comments

@Techno-Fox
Copy link

Techno-Fox commented May 13, 2020

What version of Go are you using (go version)?

go version go1.14.2 linux/amd64

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

go env Output

GO111MODULE=""
GOARCH="amd64"
GOBIN="/home/kittytechno/go/bin"
GOCACHE="/home/kittytechno/.cache/go-build"
GOENV="/home/kittytechno/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/kittytechno/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="/usr/bin/gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build970436955=/tmp/go-build -gno-record-gcc-switches"

What did you do?

strings a go executable

What did you expect to see?

no directory information

What did you see instead?

my directory information

I was trying to make a release of a go project, and I strings the executable, and I found that my directory information was stored inside. Even though I stripped debugging information.

Example :

/home/kittytechno/go_projects/src/github.com/mitchellh/go-ps/process_windows.go
and their is much more information after. This is a little scary that someone can just strings the executable and get information on my directories.

Is there a way to remove that directory information?

@ALTree
Copy link
Member

ALTree commented May 13, 2020

Is there a way to remove that directory information?

Yes, call go build with the -trimpath flag. Closing here since we don't really use the issue tracker for questions. It's just for Go bugs.

@ALTree ALTree closed this as completed May 13, 2020
@golang golang locked and limited conversation to collaborators May 13, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants