From d25e718d0ccea0f4a0020a4f298db817b9eac97e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Mart=C3=AD?= Date: Mon, 10 Jan 2022 11:35:48 +0000 Subject: [PATCH] stop passing ignoreObjects to literals.Obfuscate Literal obfuscation uses constant folding now, so it no longer needs to record identifiers to ignore. Remove the parameter and the outdated bit of docs. --- internal/literals/literals.go | 2 +- main.go | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/internal/literals/literals.go b/internal/literals/literals.go index 1cc1a46..288ee69 100644 --- a/internal/literals/literals.go +++ b/internal/literals/literals.go @@ -35,7 +35,7 @@ func randObfuscator() obfuscator { } // Obfuscate replaces literals with obfuscated anonymous functions. -func Obfuscate(file *ast.File, info *types.Info, fset *token.FileSet, ignoreObj map[types.Object]bool) *ast.File { +func Obfuscate(file *ast.File, info *types.Info, fset *token.FileSet) *ast.File { pre := func(cursor *astutil.Cursor) bool { switch x := cursor.Node().(type) { case *ast.GenDecl: diff --git a/main.go b/main.go index 238847a..dabfe2c 100644 --- a/main.go +++ b/main.go @@ -1270,7 +1270,6 @@ type transformer struct { // So far, it records: // // * Types which are used for reflection. - // * Identifiers used in constant expressions. // * Declarations exported via "//export". // * Types or variables from external packages which were not obfuscated. ignoreObjects map[types.Object]bool @@ -1366,7 +1365,7 @@ func (tf *transformer) transformGo(file *ast.File) *ast.File { // Only obfuscate the literals here if the flag is on // and if the package in question is to be obfuscated. if flagLiterals && curPkg.ToObfuscate { - file = literals.Obfuscate(file, tf.info, fset, tf.ignoreObjects) + file = literals.Obfuscate(file, tf.info, fset) } pre := func(cursor *astutil.Cursor) bool {