Skip to content

Commit

Permalink
obfuscate exported names in main
Browse files Browse the repository at this point in the history
Currently exported names in the main package are not hashed, because they
might be a Go plugin API. We don't currently support Go plugins though,
so hash them anyway.

Updates #87.
  • Loading branch information
capnspacehook authored and mvdan committed Jan 17, 2022
1 parent 87799a5 commit 474a919
Showing 1 changed file with 0 additions and 6 deletions.
6 changes: 0 additions & 6 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -1474,12 +1474,6 @@ func (tf *transformer) transformGo(file *ast.File) *ast.File {
return true // universe scope
}

if pkg.Name() == "main" && obj.Exported() && obj.Parent() == pkg.Scope() {
// TODO: only do this when -buildmode is plugin? what
// about other -buildmode options?
return true // could be a Go plugin API
}

if pkg.Path() == "embed" {
// The Go compiler needs to detect types such as embed.FS.
// That will fail if we change the import path or type name.
Expand Down

0 comments on commit 474a919

Please sign in to comment.