diff options
| author | Jeff Carr <[email protected]> | 2025-10-06 23:48:32 -0500 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-10-06 23:48:32 -0500 |
| commit | 1333cf2e9a81366ccdedfcfb0938dfa07f76b88c (patch) | |
| tree | 032c474900e1e4fe2e93986b7df854232bc752a0 | |
| parent | 6753f190dfdbef8606aea0d1abedf47f089eb49b (diff) | |
this is neat
| -rw-r--r-- | generateHeader.go | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/generateHeader.go b/generateHeader.go index 0a6ae43..274a571 100644 --- a/generateHeader.go +++ b/generateHeader.go @@ -46,6 +46,7 @@ func header(w io.Writer, pf *File) { fmt.Fprintln(w, " \"sort\"") fmt.Fprintln(w, " \"sync\"") fmt.Fprintln(w, " \"iter\"") + fmt.Fprintln(w, " \"go.wit.com/lib/config\"") fmt.Fprintln(w, ")") fmt.Fprintln(w, "") } @@ -78,10 +79,18 @@ func (pb *File) addNewFunc(w io.Writer) { fmt.Fprintln(w, " x.Uuid = \""+UUID+"\"") fmt.Fprintln(w, " x.Version = \""+VERSION+" "+pb.GoPath+"\"") if pb.DoSave { - fmt.Fprintln(w, " // x.Filename = \""+VERSION+" "+pb.GoPath+"\"") - } else { - fmt.Fprintln(w, " // wasn't here x.Filename = \""+VERSION+" "+pb.GoPath+"\"") + fmt.Fprintln(w, " // x.Filename = \"/tmp/"+STRUCT+".pb\"") } fmt.Fprintln(w, " return x") fmt.Fprintln(w, "}") + if pb.DoSave { + fmt.Fprintln(w, "") + fmt.Fprintln(w, "func (pb *"+STRUCT+") Save() error {") + fmt.Fprintln(w, " return config.Save(pb)") + fmt.Fprintln(w, "}") + fmt.Fprintln(w, "") + fmt.Fprintln(w, "func (pb *"+STRUCT+") Load() error {") + fmt.Fprintln(w, " return config.Load(pb)") + fmt.Fprintln(w, "}") + } } |
