summaryrefslogtreecommitdiff
path: root/generateAppend.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-01-12 19:32:52 -0600
committerJeff Carr <[email protected]>2025-01-12 19:32:52 -0600
commit9cb5064906e54f999ba5ef0bf402901e0f7a5d5e (patch)
tree613c1dbb08a1590249264bd1d3a6e88c81ed1df6 /generateAppend.go
parentb5002b158b10db3bf89cb6157700390911d53bea (diff)
FIX THINGS. THIS IS BETTER!v0.0.42
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()