Add blacklist for std packages

pull/114/head
Pagran 5 years ago
parent 951eb65510
commit 909fc7230e

@ -578,11 +578,26 @@ func transformCompile(args []string) ([]string, error) {
return append(flags, newPaths...), nil
}
var blacklistedPackages = [...]string{
// Hardcoded variables and methods names
"runtime",
// Constants in asm code
"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 {
for _, blacklistedPackage := range blacklistedPackages {
if path == blacklistedPackage || strings.HasPrefix(path, blacklistedPackage+"/") {
return false
}
}
println(path)
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

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

Loading…
Cancel
Save