Skip to content

Commit

Permalink
add blacklist for runtime std packages
Browse files Browse the repository at this point in the history
  • Loading branch information
pagran authored Aug 25, 2020
1 parent 951eb65 commit bd46c29
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
5 changes: 5 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -578,11 +578,16 @@ func transformCompile(args []string) ([]string, error) {
return append(flags, newPaths...), nil
}

const privateBlacklist = "runtime,internal/cpu,internal/bytealg"

// isPrivate checks if GOPRIVATE matches path.
//
// To allow using garble without GOPRIVATE for standalone main packages, it will
// default to not matching standard library packages.
func isPrivate(path string) bool {
if GlobsMatchPath(privateBlacklist, path) {
return false
}
if path == "main" || path == "command-line-arguments" || strings.HasPrefix(path, "plugin/unnamed") {
// TODO: why don't we see the full package path for main
// packages? The linker has it at the top of -importcfg, but not
Expand Down
5 changes: 2 additions & 3 deletions testdata/scripts/goprivate.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@ stderr 'does not match any packages'

[short] stop

# TODO: https://github.com/mvdan/garble/issues/108
# env GOPRIVATE='*'
# garble build -o bin ./standalone
env GOPRIVATE='*'
garble build -o bin ./standalone

-- go.mod --
module test/main
Expand Down

0 comments on commit bd46c29

Please sign in to comment.