Merge branch 'tmm1-relative-sibling-import'
diff --git a/dependency/resolver.go b/dependency/resolver.go index f53ae2f..16a7298 100644 --- a/dependency/resolver.go +++ b/dependency/resolver.go
@@ -9,6 +9,7 @@ "github.com/Masterminds/glide/cfg" "github.com/Masterminds/glide/msg" + gpath "github.com/Masterminds/glide/path" "github.com/Masterminds/glide/util" ) @@ -287,6 +288,10 @@ // and moved. l.PushBack(filepath.Join(r.VendorDir, filepath.FromSlash(imp))) } + case LocRelative: + if strings.HasPrefix(imp, "./"+gpath.VendorDir) { + msg.Warn("Go package resolving will resolve %s without the ./%s/ prefix", imp, gpath.VendorDir) + } } } @@ -779,6 +784,8 @@ // Why does a Google product get a special case build mode with a local // package? LocAppengine + // LocRelative indicates the packge is a relative directory + LocRelative ) // PkgInfo represents metadata about a package found by the resolver. @@ -815,6 +822,12 @@ Name: name, } + if strings.HasPrefix(name, "./") || strings.HasPrefix(name, "../") { + info.Loc = LocRelative + r.findCache[name] = info + return info + } + // Check _only_ if this dep is in the current vendor directory. p = filepath.Join(r.VendorDir, filepath.FromSlash(name)) if pkgExists(p) {
diff --git a/tree/tree.go b/tree/tree.go index 86977e5..1d9def2 100644 --- a/tree/tree.go +++ b/tree/tree.go
@@ -103,6 +103,11 @@ Name: name, } + if strings.HasPrefix(name, "./") || strings.HasPrefix(name, "../") { + info.Loc = dependency.LocRelative + return info + } + // Recurse backward to scan other vendor/ directories // If the cwd isn't an absolute path walking upwards looking for vendor/ // folders can get into an infinate loop.