Merge pull request #68 from colincross/selfdep
Print useful error for self-dependency
diff --git a/context.go b/context.go
index ee9beb6..af81674 100644
--- a/context.go
+++ b/context.go
@@ -1214,6 +1214,12 @@
found = m.variant.equal(newVariant)
}
if found {
+ if module == m {
+ return []error{&Error{
+ Err: fmt.Errorf("%q depends on itself", depName),
+ Pos: depsPos,
+ }}
+ }
// AddVariationDependency allows adding a dependency on itself, but only if
// that module is earlier in the module list than this one, since we always
// run GenerateBuildActions in order for the variants of a module
@@ -2615,6 +2621,9 @@
func beforeInModuleList(a, b *moduleInfo, list []*moduleInfo) bool {
found := false
+ if a == b {
+ return false
+ }
for _, l := range list {
if l == a {
found = true