Don't chase import cycles forever preparing list JSON.
Fixes #24086.
Change-Id: Ia1139d0c8d813d068c367a8baee59d240a545617
Reviewed-on: https://go-review.googlesource.com/108016
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
if count > 1 {
t.Fatal("go build mentioned import cycle more than once")
}
+
+ // Don't hang forever.
+ tg.run("list", "-e", "-json", "selfimport")
}
// cmd/go: custom import path checking should not apply to Go packages without import comment.
Objdir: b.NewObjdir(),
}
- for _, p1 := range p.Internal.Imports {
- a.Deps = append(a.Deps, b.CompileAction(depMode, depMode, p1))
+ if p.Error == nil || !p.Error.IsImportCycle {
+ for _, p1 := range p.Internal.Imports {
+ a.Deps = append(a.Deps, b.CompileAction(depMode, depMode, p1))
+ }
}
if p.Standard {