diff options
| author | Jeff Carr <[email protected]> | 2025-09-13 05:31:59 -0500 | 
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-09-13 05:31:59 -0500 | 
| commit | ddea4b6514f50cae53354ce42e6e227d31588f8d (patch) | |
| tree | 858149a978fd1c879f0fb69796e6f62fcd221193 | |
| parent | 8a531847462cc62b1cd60c52b7226f64c191adfb (diff) | |
return new pointer from Append()v0.5.3
| -rw-r--r-- | generateAppend.go | 7 | 
1 files changed, 5 insertions, 2 deletions
diff --git a/generateAppend.go b/generateAppend.go index df705f7..c81dcfb 100644 --- a/generateAppend.go +++ b/generateAppend.go @@ -14,7 +14,7 @@ import (  func (msg *MsgName) simpleAppend(w io.Writer, FRUIT, APPLES, APPLE string) string {  	LOCK := msg.getLockname("x") -	funcdef := "func (x *" + FRUIT + ") Append(y *" + APPLE + ")" +	funcdef := "func (x *" + FRUIT + ") Append(y *" + APPLE + ") *" + APPLE  	// log.Printf("\t\t(x %s) APPEND(%s)\n", FRUIT, APPLE)  	// append -- no check at all @@ -23,7 +23,10 @@ func (msg *MsgName) simpleAppend(w io.Writer, FRUIT, APPLES, APPLE string) strin  	fmt.Fprintln(w, "	"+LOCK+".Lock()")  	fmt.Fprintln(w, "	defer "+LOCK+".Unlock()")  	fmt.Fprintln(w, "") -	fmt.Fprintln(w, "	x."+APPLES+" = append(x."+APPLES+", proto.Clone(y).(*"+APPLE+"))") +	fmt.Fprintln(w, "	z := proto.Clone(y).(*"+APPLE+")") +	fmt.Fprintln(w, "	x."+APPLES+" = append(x."+APPLES+", z)") +	fmt.Fprintln(w, "") +	fmt.Fprintln(w, "	return z")  	fmt.Fprintln(w, "}")  	fmt.Fprintln(w, "")  | 
