From 89b27fa7f944643333f013d6a4d18a6852246c55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Mart=C3=AD?= Date: Mon, 13 Feb 2023 11:42:58 +0000 Subject: [PATCH] tweaks thanks to code coverage info The test package hack still appears to be needed as of Go 1.20. Interestingly, the cgo filename check does not trigger at all anymore. Presumably this means that it's not needed at all, and obfuscating code generated by cgo appears to be fine. Go with that for now. --- main.go | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/main.go b/main.go index fe52e38..0512e6b 100644 --- a/main.go +++ b/main.go @@ -1216,7 +1216,7 @@ func processImportCfg(flags []string) (newImportCfg string, _ error) { // See exporttest/*.go in testdata/scripts/test.txt. // For now, spot the pattern and avoid the unnecessary error; // the dependency is unused, so the packagefile line is redundant. - // This still triggers as of go1.19beta1. + // This still triggers as of go1.20. if strings.HasSuffix(curPkg.ImportPath, ".test]") && strings.HasPrefix(curPkg.ImportPath, impPath) { continue } @@ -1935,12 +1935,6 @@ func (tf *transformer) transformGoFile(file *ast.File) *ast.File { return true } - // TODO(mvdan): investigate obfuscating these too. - filename := fset.Position(obj.Pos()).Filename - if strings.HasPrefix(filename, "_cgo_") || strings.Contains(filename, ".cgo1.") { - return true - } - lpkg, err := listPackage(path) if err != nil { panic(err) // shouldn't happen