summaryrefslogtreecommitdiff
path: root/sort.go
diff options
context:
space:
mode:
Diffstat (limited to 'sort.go')
-rw-r--r--sort.go18
1 files changed, 14 insertions, 4 deletions
diff --git a/sort.go b/sort.go
index 8fa8e79..ff0e951 100644
--- a/sort.go
+++ b/sort.go
@@ -5,6 +5,8 @@ import (
"io"
"os"
"strings"
+
+ "go.wit.com/log"
)
// passes in the protobuf file protobuf
@@ -55,8 +57,12 @@ func (pb *Files) makeSortfile(pf *File) {
iterEnd(f, sortmap)
}
-func (msg *MsgName) syncLock(w io.Writer, s string) {
- var LOCK string = msg.Name
+func (pf *File) syncLock(w io.Writer) {
+ if pf.Bases == nil {
+ log.Info("BASES == nil in syncLock")
+ return
+ }
+ var LOCK string = pf.Bases.Lockname
fmt.Fprintln(w, "// bad global lock until modifying the .pb.go file is tested")
fmt.Fprintln(w, "// sync.RWMutex or sync.Mutex?")
@@ -64,7 +70,9 @@ func (msg *MsgName) syncLock(w io.Writer, s string) {
fmt.Fprintln(w, "")
}
-func (pf *File) iterTop(w io.Writer, BASE string) {
+func (msg *MsgName) iterTop(w io.Writer) {
+ var BASE string = msg.Name
+
fmt.Fprintln(w, "type "+BASE+"Iterator struct {")
fmt.Fprintln(w, " sync.RWMutex")
fmt.Fprintln(w, "")
@@ -94,7 +102,9 @@ func (pf *File) iterTop(w io.Writer, BASE string) {
fmt.Fprintln(w, "")
}
-func (pf *File) iterNext(w io.Writer, BASE string) {
+func (msg *MsgName) iterNext(w io.Writer) {
+ var BASE string = msg.Name
+
fmt.Fprintln(w, "// Next() returns the next thing in the array")
fmt.Fprintln(w, "func (it *"+BASE+"Iterator) Next() *"+BASE+" {")
fmt.Fprintln(w, " if it.things[it.index-1] == nil {")