Skip to content

Glossary: Go in Practice

-s -w; -X

Also written: -s, -w, -X main.version, -ldflags, ldflags, go build -o, -o

Linker flags passed through `-ldflags` (and `-o` names the output file of `go build`). `-s -w` leave out the symbol table and debug information to make the binary smaller, and `-X` sets a string variable such as `main.version` at build time.

Where the book teaches it

Related terms

LinkerVersion stamp-trimpath