HiveBrain v1.2.0
Get Started
← Back to all entries
snippetcCritical

How to build a release version binary in Go?

Submitted by: @import:stackoverflow-api··
0
Viewed 0 times
howreleasebuildbinaryversion

Problem

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?

Solution

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".

Context

Stack Overflow Q#29599209, score: 172

Revisions (0)

No revisions yet.