Skip to content

Commit

Permalink
internal/pkggraph: provide default value when node repo fails to resolve
Browse files Browse the repository at this point in the history
Sometimes the node has errors when loading the repo. If the node has errors, provide a default repo struct
  • Loading branch information
equinoxmatt authored Sep 17, 2022
1 parent 1c85fb5 commit 32f3e99
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions internal/pkggraph/graph.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit 32f3e99

Please sign in to comment.