You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
garble/testdata/scripts
Daniel Martí c9341790d4 avoid obfuscating literals set via -ldflags=-X
The -X linker flag sets a string variable to a given value,
which is often used to inject strings such as versions.

The way garble's literal obfuscation works,
we replace string literals with anonymous functions which,
when evaluated, result in the original string.

Both of these features work fine separately,
but when intersecting, they break. For example, given:

	var myVar = "original"
	[...]
	-ldflags=-X=main.myVar=replaced

The -X flag effectively replaces the initial value,
and -literals adds code to be run at init time:

	var myVar = "replaced"
	func init() { myVar = func() string { ... } }

Since the init func runs later, -literals breaks -X.
To avoid that problem,
don't obfuscate literals whose variables are set via -ldflags=-X.

We also leave TODOs about obfuscating those in the future,
but we're also leaving regression tests to ensure we get it right.

Fixes #323.
3 years ago
..
asm.txt CI: test on GOARCH=386 3 years ago
basic.txt fix binsubstr calls to not prepare for a regexp 3 years ago
cgo.txt CI: test on GOARCH=386 3 years ago
crossbuild.txt only list missing packages when obfuscating the runtime 3 years ago
debugdir.txt avoid build ID mismatches when using -debugdir 3 years ago
embed.txt deprecate using GOPRIVATE in favor of GOGARBLE (#427) 3 years ago
gogarble.txt only list missing packages when obfuscating the runtime 3 years ago
goversion.txt drop support for Go 1.16.x 4 years ago
help.txt give a useful error for "garble build -tiny" 3 years ago
implement.txt deprecate using GOPRIVATE in favor of GOGARBLE (#427) 3 years ago
imports.txt handle --long build flags properly 3 years ago
init.txt drop support for Go 1.16.x 4 years ago
ldflags.txt avoid obfuscating literals set via -ldflags=-X 3 years ago
linkname.txt deprecate using GOPRIVATE in favor of GOGARBLE (#427) 3 years ago
literals.txt support GOGARBLE=* with -literals again 3 years ago
modinfo.txt testdata: adjust for newer Go 1.18 tip version 3 years ago
plugin.txt deprecate using GOPRIVATE in favor of GOGARBLE (#427) 3 years ago
position.txt deprecate using GOPRIVATE in favor of GOGARBLE (#427) 3 years ago
reflect.txt deprecate using GOPRIVATE in favor of GOGARBLE (#427) 3 years ago
reverse.txt testdata: make pointer regexp less prone to flakes 3 years ago
seed.txt deprecate using GOPRIVATE in favor of GOGARBLE (#427) 3 years ago
syntax.txt testdata: ensure go:noinline works via runtime.Callers 3 years ago
test.txt drop support for Go 1.16.x 4 years ago
tiny.txt deprecate using GOPRIVATE in favor of GOGARBLE (#427) 3 years ago