From 58249b251fe7986a4254f0cf4a2115d7339a1089 Mon Sep 17 00:00:00 2001 From: Dan Markham Date: Thu, 4 Apr 2019 18:48:04 -0700 Subject: [PATCH] Only add the comment line when there is a comment --- stringer.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/stringer.go b/stringer.go index 1527b7d..d672639 100644 --- a/stringer.go +++ b/stringer.go @@ -110,7 +110,9 @@ func main() { // Print the header and package clause. g.Printf("// Code generated by \"enumer %s\"; DO NOT EDIT.\n", strings.Join(os.Args[1:], " ")) g.Printf("\n") - g.Printf("// %s\n", comments.String()) + if comments.String() != "" { + g.Printf("// %s\n", comments.String()) + } g.Printf("package %s", g.pkg.name) g.Printf("\n") g.Printf("import (\n")