Remove Source Path From Go's Panic Stack Trace

Remove Source Path From Go's Panic Stack Trace

I would like to share the Golang’s build flag to remove the source path (GOPATH) from panic stack trace output. In production environments or commercial projects it is sometimes not ideal to display the source path because of privacy, security or other reasons. Below is an example of a stack trace output that reveals the GOPATH location which is located inside the developer’s home directory. In this case /home/johnpili/go/ panic: Aw, snap goroutine 1 [running]: main....

February 19, 2021 · John Pili