diff options
author | Vincent Ambo <tazjin@google.com> | 2019-12-13T12·10+0000 |
---|---|---|
committer | Vincent Ambo <tazjin@google.com> | 2019-12-13T12·10+0000 |
commit | 5649c75d01dc9058d9a6092ad2a504669cc780a9 (patch) | |
tree | e31e9358f6608784859224847995ce1f8459279f /external/main.go | |
parent | 9d5417501b1bdf5f363221a14b2e2a92ef2ba3e2 (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.go | 4 |
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) |