summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2024-11-29 08:33:47 -0600
committerJeff Carr <[email protected]>2024-11-29 08:33:47 -0600
commit74498c8fcd8beef16dc61c936c46cd2374e56ece (patch)
treeeb062f9fe78a0e9ce36f42c521fdb5db6879faab
parent79e73f9abf7ecec5f9623e349a22f2d7bd05a16c (diff)
morev0.0.0
-rw-r--r--Makefile3
-rw-r--r--main.go10
2 files changed, 9 insertions, 4 deletions
diff --git a/Makefile b/Makefile
index 1026e88..98d5944 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
VERSION = $(shell git describe --tags)
BUILDTIME = $(shell date +%Y.%m.%d)
-run: build
+run: clean build
./autogenpb
vet:
@@ -31,4 +31,5 @@ reset:
reset
clean:
+ -rm test.sort.pb.go
-rm autogenpb
diff --git a/main.go b/main.go
index e791628..fb2ea38 100644
--- a/main.go
+++ b/main.go
@@ -8,11 +8,12 @@ import (
func main() {
f, _ := os.OpenFile("test.sort.pb.go", os.O_WRONLY|os.O_CREATE, 0600)
- header(f, "GitRefs")
+ header(f, "autogenpb")
+ syncLock(f, "godeplock")
}
func header(w io.Writer, name string) {
- fmt.Fprintln(w, "package gitpb")
+ fmt.Fprintln(w, "package " + name)
fmt.Fprintln(w, "")
fmt.Fprintln(w, "// this is becoming a standard format")
fmt.Fprintln(w, "// todo: autogenerate this from the .proto file?")
@@ -24,7 +25,10 @@ func header(w io.Writer, name string) {
fmt.Fprintln(w, " \"sync\"")
fmt.Fprintln(w, ")")
fmt.Fprintln(w, "")
+}
+
+func syncLock(w io.Writer, name string) {
fmt.Fprintln(w, "// bad global lock until I figure out some other plan")
- fmt.Fprintln(w, "var godeplock sync.RWMutex")
+ fmt.Fprintln(w, "var " + name + " sync.RWMutex")
fmt.Fprintln(w, "")
}