Garble wraps the Go toolchain to rename identifiers, strip metadata, and optionally obscure literals when building Go programs. It aims to reduce recoverable source detail in shipped binaries.
Overview
Garble hooks the Go compiler and linker to transform packages during a normal go build workflow. Identifiers and paths become short hashed names, positions can be obfuscated or removed, and optional modes handle literals, embedded files, control flow, and a smaller "tiny" binary layout.
Builds remain tied to cmd/go modules and caching semantics. The same inputs and seed yield reproducible obfuscation, and garble reverse can map stack traces and panic text back when source and seed are known.
Commands mirror go build, test, and run, with extra flags for literals, tiny mode, word-list naming, and custom seeds. Optional word lists replace hashes with readable token sequences at the cost of larger binaries.
Documented motivations include discouraging reverse engineering of private binaries, sharing obfuscated library source, shrinking binaries, and avoiding false positives from antivirus heuristics on Go executables.
Key features
- Wraps go build and test
- Identifier and path hashing
- Optional literal obfuscation
- Embedded file handling
- Tiny mode size reduction
- Reversible stack traces
- Deterministic seeds
- Word-list naming mode
Use cases
- Shipping closed-source Go binaries
- Reducing binary metadata leakage
- Smaller Go executables
- Sharing obfuscated Go source