Go has really awesome documentation 🗃️. I stumbled upon a build 🏗️ flag and now I know how useful it is.
From Go 1.13 onwards, we can use -trimpath build flag to include a relative path instead of an absolute path. This helps in debugging and takes you a step closer to reproducible builds.
Before Go 1.13, this flag was available with gcflags and asmflags.
Have a look at this minimal program and observe the output without and with trimpath.
Driver code -
Using the flag -
Without flag -