From 4627d89c4c189869055ac645ce183502c3f035cd Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Tue, 7 Oct 2025 01:12:59 -0500 Subject: nomutex must be the default until pb.Marshal() can be fixed --- generateHeader.go | 2 +- protoParse.go | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/generateHeader.go b/generateHeader.go index bc2d53f..a36c1e1 100644 --- a/generateHeader.go +++ b/generateHeader.go @@ -83,7 +83,7 @@ func (pb *File) addNewFunc(w io.Writer) { if pb.DoSave { fmt.Fprintln(w, "") fmt.Fprintln(w, "func (pb *"+STRUCT+") Save() error {") - fmt.Fprintln(w, " return config.Save(pb)") + fmt.Fprintln(w, " return config.SavePB(pb, pb.Filename)") fmt.Fprintln(w, "}") fmt.Fprintln(w, "") fmt.Fprintln(w, "func (pb *"+STRUCT+") Load() error {") diff --git a/protoParse.go b/protoParse.go index e09bbc3..6ecaa9d 100644 --- a/protoParse.go +++ b/protoParse.go @@ -191,12 +191,15 @@ func (pf *File) parseForMessage(line string) *MsgName { msg.Lockname = pf.Filebase + "Mu" // this should be lowercase. do not export the Mutex msg.NeedIter = true + // making this the default. it's confirmed pb.Marshal() panics with the existance of a sync var + msg.NoMutex = true if strings.Contains(line, "`autogenpb:mutex`") { msg.DoMutex = true + msg.NoMutex = false // log.Info("Added Mutex=true:", msg.Name) } if strings.Contains(line, "`autogenpb:nomutex`") { - msg.NoMutex = true + // msg.NoMutex = true // log.Info("Added Mutex=true:", msg.Name) } if strings.Contains(line, "`autogenpb:marshal`") { -- cgit v1.2.3