more
This commit is contained in:
parent
79e73f9abf
commit
74498c8fcd
3
Makefile
3
Makefile
|
@ -1,7 +1,7 @@
|
||||||
VERSION = $(shell git describe --tags)
|
VERSION = $(shell git describe --tags)
|
||||||
BUILDTIME = $(shell date +%Y.%m.%d)
|
BUILDTIME = $(shell date +%Y.%m.%d)
|
||||||
|
|
||||||
run: build
|
run: clean build
|
||||||
./autogenpb
|
./autogenpb
|
||||||
|
|
||||||
vet:
|
vet:
|
||||||
|
@ -31,4 +31,5 @@ reset:
|
||||||
reset
|
reset
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
|
-rm test.sort.pb.go
|
||||||
-rm autogenpb
|
-rm autogenpb
|
||||||
|
|
10
main.go
10
main.go
|
@ -8,11 +8,12 @@ import (
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
f, _ := os.OpenFile("test.sort.pb.go", os.O_WRONLY|os.O_CREATE, 0600)
|
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) {
|
func header(w io.Writer, name string) {
|
||||||
fmt.Fprintln(w, "package gitpb")
|
fmt.Fprintln(w, "package " + name)
|
||||||
fmt.Fprintln(w, "")
|
fmt.Fprintln(w, "")
|
||||||
fmt.Fprintln(w, "// this is becoming a standard format")
|
fmt.Fprintln(w, "// this is becoming a standard format")
|
||||||
fmt.Fprintln(w, "// todo: autogenerate this from the .proto file?")
|
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, " \"sync\"")
|
||||||
fmt.Fprintln(w, ")")
|
fmt.Fprintln(w, ")")
|
||||||
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, "// 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, "")
|
fmt.Fprintln(w, "")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue