summaryrefslogtreecommitdiff
path: root/generateAppend.go
diff options
context:
space:
mode:
Diffstat (limited to 'generateAppend.go')
-rw-r--r--generateAppend.go12
1 files changed, 7 insertions, 5 deletions
diff --git a/generateAppend.go b/generateAppend.go
index d233bfc..bf9d837 100644
--- a/generateAppend.go
+++ b/generateAppend.go
@@ -3,26 +3,28 @@ package main
import (
"fmt"
"io"
-
- "go.wit.com/log"
)
// generates Append()
// I like these functions the best.
-func (msg *MsgName) simpleAppend(w io.Writer, FRUIT, APPLES, APPLE string) {
+func (msg *MsgName) simpleAppend(w io.Writer, FRUIT, APPLES, APPLE string) string {
LOCK := msg.getLockname("x")
- log.Printf("\t\t(x %s) APPEND(%s)\n", FRUIT, APPLE)
+ funcdef := "func (x *" + FRUIT + ") Append(y *" + APPLE + ")"
+
+ // 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, "func (x *"+FRUIT+") Append(y *"+APPLE+") {")
+ 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, "}")
fmt.Fprintln(w, "")
+
+ return funcdef
}
/* FIX THSE as Import()