summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-01-10 04:37:54 -0600
committerJeff Carr <[email protected]>2025-01-10 04:37:54 -0600
commitd9e5edb3a8486bc884841137095dd910e42b3a98 (patch)
treee4ef81c86db853d1747f515c198129d27c4a6600
parent88e4359cdec41a29750586202b15fa2dabb89e55 (diff)
hotfixv0.0.40
-rw-r--r--addMutex.go4
-rw-r--r--argv.go15
2 files changed, 11 insertions, 8 deletions
diff --git a/addMutex.go b/addMutex.go
index 1b1db0c..5e374f8 100644
--- a/addMutex.go
+++ b/addMutex.go
@@ -39,7 +39,7 @@ func (pb *Files) addMutex(f *File) error {
start := "type " + msg.Name + " struct {"
// marshalThing(w, msg.Name)
// log.Info("line:", line)
- if strings.HasSuffix(line, start) {
+ if strings.HasPrefix(line, start) {
msg.MutexFound = true
found = true
if argv.Mutex {
@@ -53,6 +53,8 @@ func (pb *Files) addMutex(f *File) error {
fmt.Fprintln(w, "\t// Lock sync.RWMutex // autogenpb skipped this. needs --mutex command line arg")
fmt.Fprintln(w, "")
}
+ // important to exit here. somehow this matched twice at one point. notsure how
+ break
}
}
if !found {
diff --git a/argv.go b/argv.go
index 7357f6b..676e67e 100644
--- a/argv.go
+++ b/argv.go
@@ -9,13 +9,14 @@ package main
var argv args
type args struct {
- Package string `arg:"--package" help:"the package name"`
- Proto string `arg:"--proto" help:"the .proto filename"`
- Mutex bool `arg:"--mutex" default:"true" help:"insert a mutex into protoc .pb.go file"`
- Delete bool `arg:"--delete" help:"use delete with copy experiment"`
- DryRun bool `arg:"--dry-run" help:"show what would be run"`
- GoSrc string `arg:"--go-src" help:"default is ~/go/src. could be set to your go.work path"`
- GoPath string `arg:"--gopath" help:"the gopath of this repo"`
+ Package string `arg:"--package" help:"the package name"`
+ Proto string `arg:"--proto" help:"the .proto filename"`
+ Mutex bool `arg:"--mutex" default:"true" help:"insert a mutex into protoc .pb.go file"`
+ Delete bool `arg:"--delete" help:"use delete with copy experiment"`
+ DryRun bool `arg:"--dry-run" help:"show what would be run"`
+ GoSrc string `arg:"--go-src" help:"default is ~/go/src. could be set to your go.work path"`
+ GoPath string `arg:"--gopath" help:"the gopath of this repo"`
+ Identify string `arg:"--identify" help:"identify file"`
}
func (a args) Description() string {