return new pointer from Append()
This commit is contained in:
parent
8a53184746
commit
ddea4b6514
|
@ -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, "")
|
||||
|
||||
|
|
Loading…
Reference in New Issue