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.
This commit is contained in:
Vincent Ambo 2019-12-13 12:10:32 +00:00
parent 9d5417501b
commit 5649c75d01

4
external/main.go vendored
View file

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