summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-01-09 16:02:53 -0600
committerJeff Carr <[email protected]>2025-01-09 16:02:53 -0600
commitb1961c371da567692314f775f9bdcb95837d9278 (patch)
tree0aebbe3b1246aef3e9265452da6176d83f7d6464
parentfe98085712189edea536d9207b40f8b0daf826ef (diff)
auto test both. logic is correct now. seems to work
-rw-r--r--Makefile3
-rw-r--r--example/Makefile10
-rw-r--r--sort.go5
3 files changed, 13 insertions, 5 deletions
diff --git a/Makefile b/Makefile
index 97ef344..fc8683e 100644
--- a/Makefile
+++ b/Makefile
@@ -29,7 +29,8 @@ auto:
rm -f auto.sort.pb.go auto.newsort.pb.go # auto.marshal.pb.go
test:
- make -C example full
+ make -C example rawproto
+ make -C example modproto
junk:
cd example; rm -f go.* *.pb.go
diff --git a/example/Makefile b/example/Makefile
index a489ec4..c744d23 100644
--- a/example/Makefile
+++ b/example/Makefile
@@ -1,7 +1,10 @@
VERSION = $(shell git describe --tags)
BUILDTIME = $(shell date +%Y.%m.%d_%H%M)
-full: clean auto goimports vet build
+modproto: clean withMutex goimports vet build
+ ./example
+
+rawproto: clean withoutMutex goimports vet build
./example
vet:
@@ -10,9 +13,12 @@ vet:
build:
GO111MODULE=off go build
-auto:
+withMutex:
../autogenpb --proto fruit.proto --package main --mutex
+withoutMutex:
+ ../autogenpb --proto fruit.proto --package main
+
goimports:
goimports -w *.go
diff --git a/sort.go b/sort.go
index eb2defa..d60ebb8 100644
--- a/sort.go
+++ b/sort.go
@@ -191,9 +191,10 @@ func (pf *File) appendUnique(w io.Writer, blah *MsgName, names map[string]string
var LOCK string = pf.Bases.Lockname
if argv.Mutex {
- LOCK = pf.Bases.Lockname
- } else {
+ // use the mutex lock from the modified protoc.pb.go file
LOCK = "all.Lock"
+ } else {
+ LOCK = pf.Bases.Lockname
}
fmt.Fprintln(w, "// enforces "+BASE+" is unique")