From 0d662564aab44526f2a28a7e0de9aeb0b627e973 Mon Sep 17 00:00:00 2001 From: Greg Date: Fri, 3 Aug 2018 16:39:01 -0400 Subject: [PATCH] Bug fix in gen.go: do not try to write if there is no output. --- cmd/pgen/gen.go | 3 +++ 1 file changed, 3 insertions(+) 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")