summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-08-28 19:29:04 -0500
committerJeff Carr <[email protected]>2025-08-28 19:29:04 -0500
commit65fe2fa9c117b509898133aaeda841a4b153e625 (patch)
treeab461d8ce408c3c393227eac531741bcd8fdd004
parent931e7ac1a614f1fca33cd5bbf026cc061e196dcb (diff)
duh. always should proto.Clone on Append()v0.0.76
-rw-r--r--generateAppend.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/generateAppend.go b/generateAppend.go
index ac53974..df705f7 100644
--- a/generateAppend.go
+++ b/generateAppend.go
@@ -18,12 +18,12 @@ func (msg *MsgName) simpleAppend(w io.Writer, FRUIT, APPLES, APPLE string) strin
// log.Printf("\t\t(x %s) APPEND(%s)\n", FRUIT, APPLE)
// append -- no check at all
- fmt.Fprintln(w, "// just a simple Append() shortcut (but still uses the mutex lock)")
+ fmt.Fprintln(w, "// a Append() shortcut (that does Clone() with a mutex) notsure if it really works")
fmt.Fprintln(w, funcdef, "{")
fmt.Fprintln(w, " "+LOCK+".Lock()")
fmt.Fprintln(w, " defer "+LOCK+".Unlock()")
fmt.Fprintln(w, "")
- fmt.Fprintln(w, " x."+APPLES+" = append(x."+APPLES+", y)")
+ fmt.Fprintln(w, " x."+APPLES+" = append(x."+APPLES+", proto.Clone(y).(*"+APPLE+"))")
fmt.Fprintln(w, "}")
fmt.Fprintln(w, "")
@@ -92,7 +92,7 @@ func (msg *MsgName) addAppendBy(w io.Writer, STRUCT, FUNCNAME, STRUCTVAR, VARNAM
fmt.Fprintln(w, " }")
fmt.Fprintln(w, " }")
fmt.Fprintln(w, "")
- fmt.Fprintln(w, " x."+STRUCTVAR+" = append(x."+STRUCTVAR+", y)")
+ fmt.Fprintln(w, " x."+STRUCTVAR+" = append(x."+STRUCTVAR+", proto.Clone(y).(*"+VARTYPE+"))")
fmt.Fprintln(w, " return true")
fmt.Fprintln(w, "}")
fmt.Fprintln(w, "")