burrowers /garble

Obfuscate Go builds

★ 5,825⑂ 391👁 39⑃ 838● 461▤ 28
GoBSD-3-ClauseCreated 2019-12-08
Download: v0.18.0garble-0.18.0 ↓0.18.02026-09-19
+2
Daily
5,825
stars
391
forks
39
watchers
838
prs
461
issues
28
releases

README

garble




	go install mvdan.cc/garble@latest  or @master

Obfuscate Go code by wrapping the Go toolchain. Requires Go 1.27 or later.

	garble build [build flags] [packages]

The tool also supports garble test to run tests with obfuscated code,
garble run to obfuscate and execute simple programs,
garble reverse to de-obfuscate text such as stack traces,
and garble bug to file a pre-filled bug report.
Run garble -h to see all available commands and flags.

 Purpose

Produce a binary that works as well as a regular build, but that has as little
information about the original source code as possible.

The tool is designed to be:

 Coupled with cmd/go, to support modules and build caching
 Deterministic and reproducible, given the same initial source code
 Reversible given the original source, to de-obfuscate panic stack traces

 Mechanism

The tool wraps calls to the Go compiler and linker to transform the Go build, in
order to:

 Replace identifiers and package paths with short base64 hashes
 Replace position information with short base64 hashed filenames
 Remove all build, module, and debug information
 Obfuscate literals and embedded files, if the -literals flag is given
 Remove extra information, if the -tiny flag is given

The tool obfuscates all packages being built, including the standard runtime.
Runtime obfuscation follows Go's supported GOOS/GOARCH targets; Garble does not
maintain a narrower architecture allowlist.

Note that commands like garble build will use the go version found in your
$PATH. To use different versions of Go, you can use GOTOOLCHAIN.

 Use cases

A common question is why a code obfuscator is needed for Go, a compiled language.
Go binaries include a surprising amount of information about the original source;
even with debug information and symbol tables stripped, many names and positions
remain in place for the sake of traces, reflection, and debugging.

Some use cases for Go require sharing a Go binary with the end user.
If the source code for the binary is private or requires a purchase,
its obfuscation can help discourage reverse engineering.

A similar use case is a Go library whose source is private or purchased.
Since Go libraries cannot be imported in binary form, and Go plugins
have their shortcomings,
sharing obfuscated source code becomes an option.
See 369.

Obfuscation can also help with aspects entirely unrelated to licensing.
For example, the -tiny flag can make binaries 15% smaller,
similar to the common practice in Android to reduce app sizes.
Obfuscation has also helped some open source developers work around
anti-virus scans incorrectly treating Go binaries as malware.

 Word-list naming

Use garble -wordlist=words.txt build to replace identifier, package-path,
and filename hashes with underscore-separated combinations of words.

The file contains one lowercase ASCII word per line, at most eight letters per
word. Blank lines and surrounding whitespace are ignored. The list is sorted
and deduplicated, s

Top issues

Discussions

Latest release

v0.18.0 v0.18.0 2026-09-19
This release adds support for Go 1.27 and drops support for Go 1.26.

Builds are now 10% to 15% faster, depending on the size of the build and the number of spare CPU cores, as the patched linker is now built in the background while packages are listed rather than right before linking.

Experimental control flow obfuscation via //garble:controlflow is now reproducible for a given -seed, and handles many more Go constructs: bound method values, generic conversions, types declared in block scopes, named map and string types, blank struct fields, and comma-ok receives in select. Ranging over 

Snapshot: 2026-11-16T09:23:14Z · Data license Apache-2.0 · JSON