burrowers / garble

Obfuscate Go builds
BSD 3-Clause "New" or "Revised" License
3.93k stars 248 forks source link

recheck types after obfuscation of literals #790

Closed lu4p closed 10 months ago

lu4p commented 1 year ago

Fixes #649

EDIT: This works for simple cases. I don't want to investigate why the tests are failing as I don't think this is important enough to fix to warrant another typecheck.

mvdan commented 1 year ago

Personally I don't think typechecking again from scratch is the right approach - it's far too expensive. Typechecking once is already slow enough :)

We could consider having the literals code update the type information as it changes the syntax tree. I'm not sure if that's feasible with go/types, and it might be a bit complex, but it would be faster for sure.

An alternative would be for the literal obfuscation to happen with the syntax tree alone - before we have typechecked. This would be the simplest fix, but it might also make literal obfuscation less useful in cases like "foo" + "bar".