From d91564f63c7a1372e4b6f11f96c3d0e8b16b0c98 Mon Sep 17 00:00:00 2001 From: Pagran <67878280+pagran@users.noreply.github.com> Date: Tue, 25 Aug 2020 16:52:39 +0300 Subject: [PATCH] Simplify --- main.go | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/main.go b/main.go index 4131bae..58c2e53 100644 --- a/main.go +++ b/main.go @@ -578,24 +578,15 @@ 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", -} +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 { - for _, blacklistedPackage := range blacklistedPackages { - if path == blacklistedPackage || strings.HasPrefix(path, blacklistedPackage+"/") { - return false - } + 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