Skip to content

Commit

Permalink
fix(gpd): don't panic on invalid root
Browse files Browse the repository at this point in the history
  • Loading branch information
JamyDev authored and tyler-french committed Dec 17, 2023
1 parent d5bc6ad commit 56e63e8
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions go/tools/gopackagesdriver/packageregistry.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ package main

import (
"fmt"
"os"
"strconv"
"strings"
)
Expand Down Expand Up @@ -83,6 +84,11 @@ func (pr *PackageRegistry) ResolveImports() error {
func (pr *PackageRegistry) walk(acc map[string]*FlatPackage, root string) {
pkg := pr.packagesByID[root]

if pkg == nil {
fmt.Fprintf(os.Stderr, "Error: package ID not found %v\n", root)
return
}

acc[pkg.ID] = pkg
for _, pkgID := range pkg.Imports {
if _, ok := acc[pkgID]; !ok {
Expand Down

0 comments on commit 56e63e8

Please sign in to comment.