summaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
Diffstat (limited to 'main.go')
-rw-r--r--main.go23
1 files changed, 21 insertions, 2 deletions
diff --git a/main.go b/main.go
index 59d4ded..df6d00d 100644
--- a/main.go
+++ b/main.go
@@ -2,9 +2,10 @@
// +build go1.20
// protobuf the way I am using them, require GO 1.20. I think. I could be wrong.
+// The Go Protocol Buffers library embeds a sync.Mutex within the MessageState struct to prevent unintended shallow copies of message structs
+// this optionally (but it is the default) inserts a mutex into the struct generated by protoc
-// go:generate go-mod-clean
-// go:generate autogenpb auto.proto
+// go:generate autogenpb --proto file.proto
package main
@@ -25,6 +26,8 @@ import (
var VERSION string
var BUILDTIME string
+var fsort *os.File // the sort.pb.go output file
+
func main() {
pp := arg.MustParse(&argv)
@@ -51,6 +54,7 @@ func main() {
pf := new(File)
pb.Files = append(pb.Files, pf)
pf.Filename = argv.Proto
+ pf.IterMap = make(map[string]string)
pf.Filebase = strings.TrimSuffix(argv.Proto, ".proto")
@@ -69,6 +73,21 @@ func main() {
badExit(fmt.Errorf("Base was nil. 'message %s {` did not exist", pf.Filebase))
}
+ /*
+ // prep the output file
+ if !argv.DryRun {
+ var err error
+ fsort, err = os.OpenFile(pf.Filebase+".newsort.pb.go", os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0644)
+ if err != nil {
+ badExit(err)
+ }
+ defer fsort.Close()
+
+ header(fsort, pf)
+ pf.syncLock(fsort)
+ }
+ */
+
// show the protobuf of the protobuf. It's like Inception
pf.printMsgTable()