Garble is a code obfuscator that wraps the Go toolchain to produce obfuscated binaries.
The tool addresses the problem that Go binaries retain substantial information about their original source code despite being compiled—names, package paths, and position information persist for reflection, tracing, and debugging purposes. Garble works by intercepting calls to the Go compiler and linker, replacing identifiers and package paths with short base64 hashes, substituting position information with hashed filenames, and stripping build, module, and debug metadata. Optional flags enable literal obfuscation to replace string and other literal expressions with equivalent runtime-computed values, and a tiny mode that further reduces binary size.
Garble suits projects where source code must remain private or proprietary while distributing compiled binaries to end users, or where obfuscated source code serves as an alternative to binary-only library distribution in Go's module ecosystem. The tool is designed to be deterministic and reproducible given the same source, and it includes a reverse command to de-obfuscate stack traces using the original source. Developers should note that obfuscation is opt-in per package via the GOGARBLE environment variable, following the same glob-pattern format as GOPRIVATE, and that the tool requires Go 1.27 or later. Beyond licensing concerns, the tiny mode can reduce binary size by a meaningful margin, and obfuscation has proven useful for working around false-positive malware detection in some cases.
The project maintains active engagement with its issue tracker, addressing user-reported problems and feature requests. Development includes regular refinement of the obfuscation mechanism to handle edge cases in Go's reflection and runtime systems. The maintainers prioritize compatibility with the evolving Go toolchain, ensuring the wrapper approach continues to function across Go versions.