Answer the question
In order to leave comments, you need to log in
Golang how to compile application without debug information?
Good afternoon, I'm compiling the application using the following command:
go build -ldflags '-s -w' main_app.go
If a panic occurs during the program, I get a message, for example:
panic: runtime error: index out of range
goroutine 1 [running] :
main.main()
/emanuel/go/test_app/main_app.go:64 +0x324
exit status 2
Where is this information stored in the binary? Can it be removed from the binary?
Answer the question
In order to leave comments, you need to log in
If you need to remove the real paths to the files so that /emanuel/go is not lit, then this can be done using the GOROOT_FINAL environment variable
.
It is currently impossible to completely remove information about the stack trace from the binary, as far as I know.
you can hide/replace absolute paths on errors, etc. -gcflags="-trimpath=$GOPATH/src"
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question