about summary refs log tree commit diff
path: root/external/main.go
diff options
context:
space:
mode:
authorVincent Ambo <tazjin@google.com>2019-12-13T12·10+0000
committerVincent Ambo <tazjin@google.com>2019-12-13T12·10+0000
commit5649c75d01dc9058d9a6092ad2a504669cc780a9 (patch)
treee31e9358f6608784859224847995ce1f8459279f /external/main.go
parent9d5417501b1bdf5f363221a14b2e2a92ef2ba3e2 (diff)
fix(external): Fix "inverted" local dependencies
Usually in large packages the root depends on one or more
sub-packages (or there is no root), but some projects (e.g.
golang.org/x/oauth2) do it the other way around.

This fix adds compatibility for both ways.
Diffstat (limited to 'external/main.go')
-rw-r--r--external/main.go4
1 files changed, 3 insertions, 1 deletions
diff --git a/external/main.go b/external/main.go
index e0b95605f0dd..d73f1540a986 100644
--- a/external/main.go
+++ b/external/main.go
@@ -89,7 +89,9 @@ func analysePackage(root, source, importpath string, stdlib map[string]bool) (pk
 			continue
 		}
 
-		if strings.HasPrefix(i, importpath) {
+		if i == importpath {
+			local = append(local, []string{})
+		} else if strings.HasPrefix(i, importpath) {
 			local = append(local, strings.Split(strings.TrimPrefix(i, importpath+"/"), "/"))
 		} else {
 			foreign = append(foreign, i)