Parse comments in the template and write them to the output files.

This commit is contained in:
Greg 2018-08-06 11:06:33 -04:00
parent bc06994bcf
commit 62c409292b
2 changed files with 4 additions and 2 deletions

View File

@ -122,7 +122,7 @@ func (g *Generator) Add(newName, typName, typ string) {
subspec{regexp.MustCompile("_N"), typName}, subspec{regexp.MustCompile("_N"), typName},
subspec{regexp.MustCompile("_T"), typ}} subspec{regexp.MustCompile("_T"), typ}}
f, err := parser.ParseFile(g.fset, "", template, 0) f, err := parser.ParseFile(g.fset, "", template, parser.ParseComments)
if err != nil { if err != nil {
log.Fatal("Parsing persist/template.T:",err) log.Fatal("Parsing persist/template.T:",err)
} }

View File

@ -1,5 +1,7 @@
package main package main
const template string = `package main const template string = `//Generated by gitlab.wow.st/persist/cmd/pgen.
//Do not edit
package main
import ( import (
"encoding/gob" "encoding/gob"