summaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-01-12 01:32:52 -0600
committerJeff Carr <[email protected]>2025-01-12 01:32:52 -0600
commitcfd9ec5ccddded628f4f9bf95beefc11dcfeb51b (patch)
tree9db213a7458b52cec79ee68a0a2911ed2cb4b2f3 /main.go
parent0d2dc9fb2518a34d5f60836a92ebeef4d57a3943 (diff)
refactor again. I want to make this clean
as clean as possible because, I use this tool alot. everywhere. I want it to always work. I need do not want it to break
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()