mirror of
https://github.com/burrowers/garble.git
synced 2026-04-22 23:57:14 +08:00
avoid breaking github.com/davecgh/go-spew
It assumes that reflect.Value has a field named "flag", which wasn't the case with obfuscated builds as we obfuscated it. We already treated the reflect package as special, for instance when not obfuscating Method or MethodByName. In a similar fashion, mark reflect's rtype and Value types to not be obfuscated alongside their field names. Note that rtype is the implementation behind the reflect.Type interface. This fix is fairly manual and repetitive. transformCompile, transformLinkname, and transformAsm should all use the same mechanism to tell if names should be obfuscated. However, they do not do that right now, and that refactor feels too risky for a bugfix release. We add more TODOs instead. We're not adding go-spew to scripts/check-third-party.sh since the project is largely abandoned. It's not even a Go module yet. The only broken bit from it is what we've added to our tests. Fixes #676.
This commit is contained in:
Vendored
+10
@@ -154,6 +154,16 @@ type FmtType struct {
|
||||
FmtTypeField int
|
||||
}
|
||||
|
||||
// copied from github.com/davecgh/go-spew, which reaches into reflect's internals
|
||||
var _ = func() uintptr {
|
||||
field, ok := reflect.TypeOf(reflect.Value{}).FieldByName("flag")
|
||||
if !ok {
|
||||
panic("reflect.Value has no flag field")
|
||||
}
|
||||
return field.Offset
|
||||
}()
|
||||
|
||||
|
||||
-- importedpkg/imported.go --
|
||||
package importedpkg
|
||||
|
||||
|
||||
Reference in New Issue
Block a user