From 32f3e99172a041695abf0e2faad25d9475cbc1e8 Mon Sep 17 00:00:00 2001 From: equinoxmatt Date: Sat, 17 Sep 2022 06:47:21 +0100 Subject: [PATCH] internal/pkggraph: provide default value when node repo fails to resolve Sometimes the node has errors when loading the repo. If the node has errors, provide a default repo struct --- internal/pkggraph/graph.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/internal/pkggraph/graph.go b/internal/pkggraph/graph.go index cc9f224..972731f 100644 --- a/internal/pkggraph/graph.go +++ b/internal/pkggraph/graph.go @@ -100,6 +100,11 @@ func LoadNode(p *packages.Package) *Node { if repo, err := vcs.RepoRootForImportPath(p.PkgPath, false); err != nil { node.Errors = append(node.Errors, err) + node.Repo = &vcs.RepoRoot{ + VCS: &vcs.Cmd{}, + Repo: p.PkgPath, + Root: p.PkgPath, + } } else { node.Repo = repo }