In C, we can build a debug version or a release version of the binary files (the object files and the executable). How can we do this in Go?
hiwjd0
In Go, it isn't typical to have a debug version or a release version.
By default, go build
combines symbol and debug info with binary files. However, you can remove the symbol and debug info with go build -ldflags "-s -w"
.
来源:https://stackoverflow.com/questions/29599209/how-to-build-a-release-version-binary-in-go