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í c9b0b07853 hash field names equally in all packages
Packages P1 and P2 can define identical struct types T1 and T2, and one
can convert from type T1 to T2 or vice versa.

The spec defines two identical struct types as:

	Two struct types are identical if they have the same sequence of
	fields, and if corresponding fields have the same names, and
	identical types, and identical tags. Non-exported field names
	from different packages are always different.

Unfortunately, garble broke this: since we obfuscated field names
differently depending on the package, cross-package conversions like the
case above would result in typechecking errors.

To fix this, implement Joe Tsai's idea: hash struct field names with the
string representation of the entire struct. This way, identical struct
types will have their field names obfuscated in the same way in all
packages across a build.

Note that we had to refactor "reverse" a bit to start using transformer,
since now it needs to keep track of struct types as well.

This failure was affecting the build of google.golang.org/protobuf,
since it makes regular use of cross-package struct conversions.

Note that the protobuf module still fails to build, but for other
reasons. The package that used to fail now succeeds, so the build gets a
bit further than before. #240 tracks adding relevant third-party Go
modules to CI, so we'll track the other remaining failures there.

Fixes #310.
3 years ago
..
asm.txt obfuscate asm function names as well (#273) 3 years ago
basic.txt testdata: reduce the cost of short tests 3 years ago
cgo.txt all: drop support for Go 1.15.x (#265) 3 years ago
crossbuild.txt fix windows/arm cross-build linking 3 years ago
debugdir.txt refactor "current package" with TOOLEXEC_IMPORTPATH (#266) 3 years ago
embed.txt don't obfuscate the "embed" import path 3 years ago
goprivate.txt obfuscate asm function names as well (#273) 3 years ago
goversion.txt use "go env -json" to collect env info all at once 3 years ago
help.txt make "help" refuse arguments for now 3 years ago
implement.txt hash field names equally in all packages 3 years ago
imports.txt all: drop support for Go 1.15.x (#265) 3 years ago
init.txt all: drop support for Go 1.15.x (#265) 3 years ago
ldflags.txt testdata: remove some unnecessary execs (#267) 3 years ago
linkname.txt fix obfuscating linkname directives that where the package name contained a dot 3 years ago
literals.txt make -literals succeed on all of std 3 years ago
modinfo.txt testdata: remove some unnecessary execs (#267) 3 years ago
plugin.txt all: drop support for Go 1.15.x (#265) 3 years ago
position.txt hopefully fix position test on Windows by not matching on 'main.go' 3 years ago
reverse.txt support reversing field names 3 years ago
seed.txt make flags like -literals and GOPRIVATE affect hashing (#288) 3 years ago
syntax.txt record types into ignoreObjects more reliably 3 years ago
test.txt testdata: reduce the cost of short tests 3 years ago
tiny.txt remove obsolete TODO in the tiny.txt test 3 years ago