diff --git a/cmd/pgen/gen.go b/cmd/pgen/gen.go index b974515..cf83c10 100644 --- a/cmd/pgen/gen.go +++ b/cmd/pgen/gen.go @@ -131,6 +131,9 @@ func newImportSpec(name string) *ast.ImportSpec { } func gen(wantImps []string) { + if nodes == nil { + return + } of, err := os.Create("pgen.go") if err != nil { log.Fatal("Cannot open pgen.go")