Added nil check in case packages.Load can't get module info
@@ -60,9 +60,12 @@ func NewGenerator(cmd string, path, output string) *Generator {
fset := token.NewFileSet()
p := regexp.MustCompile(`goa.design/goa/v(\d+)/dsl`)
for _, pkg := range pkgs {
+ // Nil check in case packages.Load can't get module info
+ if pkg.Module != nil {
if _, err := os.Stat(filepath.Join(pkg.Module.Dir, "vendor")); !os.IsNotExist(err) {
hasVendorDirectory = true
}
+ }
for _, gof := range pkg.GoFiles {
if bs, err := ioutil.ReadFile(gof); err == nil {
if f, err := parser.ParseFile(fset, "", string(bs), parser.ImportsOnly); err == nil {
