add blacklist for runtime std packages

pull/117/head
pagran 5 years ago committed by GitHub
parent 951eb65510
commit bd46c29380
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -578,11 +578,16 @@ func transformCompile(args []string) ([]string, error) {
return append(flags, newPaths...), nil return append(flags, newPaths...), nil
} }
const privateBlacklist = "runtime,internal/cpu,internal/bytealg"
// isPrivate checks if GOPRIVATE matches path. // isPrivate checks if GOPRIVATE matches path.
// //
// To allow using garble without GOPRIVATE for standalone main packages, it will // To allow using garble without GOPRIVATE for standalone main packages, it will
// default to not matching standard library packages. // default to not matching standard library packages.
func isPrivate(path string) bool { func isPrivate(path string) bool {
if GlobsMatchPath(privateBlacklist, path) {
return false
}
if path == "main" || path == "command-line-arguments" || strings.HasPrefix(path, "plugin/unnamed") { if path == "main" || path == "command-line-arguments" || strings.HasPrefix(path, "plugin/unnamed") {
// TODO: why don't we see the full package path for main // TODO: why don't we see the full package path for main
// packages? The linker has it at the top of -importcfg, but not // packages? The linker has it at the top of -importcfg, but not

@ -4,9 +4,8 @@ stderr 'does not match any packages'
[short] stop [short] stop
# TODO: https://github.com/mvdan/garble/issues/108 env GOPRIVATE='*'
# env GOPRIVATE='*' garble build -o bin ./standalone
# garble build -o bin ./standalone
-- go.mod -- -- go.mod --
module test/main module test/main

Loading…
Cancel
Save