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í 691a44cecb avoid breaking const declarations using iotas
With the -literals flag, we try to convert some const declarations to
vars, as long as that doesn't break typechecking. We really only do that
for typed constant strings, really.

There was a quirk: if a numerical constant had a type and used iota, we
would not obfuscate its value, but we would still convert the
declaration from const to var. Since iotas only work within const
declarations, that would break compilation:

	> garble -literals build
	[stderr]
	# test/main
	FeWE3zwi.go:19: undefined: iota
	exit status 2

To fix the problem, make the logic more conservative: only obfuscate
constant declarations where the values are typed strings, meaning that
any numerical constants are left entirely untouched.

This fixes the build of google.golang.org/protobuf/runtime/protoiface
with -literals turned on.
4 years ago
..
asm.txt obfuscate asm function names as well (#273) 4 years ago
basic.txt testdata: use longer Go filenames for binsubstr 4 years ago
cgo.txt fix a link issue when obfuscating complex cgo packages 4 years ago
crossbuild.txt fix windows/arm cross-build linking 4 years ago
debugdir.txt refactor "current package" with TOOLEXEC_IMPORTPATH (#266) 4 years ago
embed.txt support embedding via embed.FS 4 years ago
goprivate.txt avoid reproducibility issues with full rebuilds 4 years ago
goversion.txt use "go env -json" to collect env info all at once 4 years ago
help.txt make "garble command -h" give command-specific help 4 years ago
implement.txt remove tinyfmt implementation from a test script 4 years ago
imports.txt testdata: use longer Go filenames for binsubstr 4 years ago
init.txt all: drop support for Go 1.15.x (#265) 4 years ago
ldflags.txt testdata: remove some unnecessary execs (#267) 4 years ago
linkname.txt fix obfuscating linkname directives that where the package name contained a dot 4 years ago
literals.txt avoid breaking const declarations using iotas 4 years ago
modinfo.txt testdata: remove some unnecessary execs (#267) 4 years ago
plugin.txt all: drop support for Go 1.15.x (#265) 4 years ago
position.txt testdata: use longer Go filenames for binsubstr 4 years ago
reflect.txt testdata: use longer Go filenames for binsubstr 4 years ago
reverse.txt update support for Go 1.17 in time for beta1 4 years ago
seed.txt make flags like -literals and GOPRIVATE affect hashing (#288) 4 years ago
syntax.txt support aliases as embedded fields in dependencies 4 years ago
test.txt testdata: reduce the cost of short tests 4 years ago
tiny.txt testdata: deduplicate GODEBUG cleanup line 4 years ago