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.
pull/681/head
Daniel Martí 1 year ago committed by pagran
parent e37f39054d
commit 89b27fa7f9

@ -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

Loading…
Cancel
Save