autogenpb/main.go

31 lines
731 B
Go
Raw Normal View History

2024-11-29 08:30:19 -06:00
package main
import (
"fmt"
"io"
"os"
)
func main() {
f, _ := os.OpenFile("test.sort.pb.go", os.O_WRONLY|os.O_CREATE, 0600)
header(f, "GitRefs")
}
func header(w io.Writer, name string) {
fmt.Fprintln(w, "package gitpb")
fmt.Fprintln(w, "")
fmt.Fprintln(w, "// this is becoming a standard format")
fmt.Fprintln(w, "// todo: autogenerate this from the .proto file?")
fmt.Fprintln(w, "")
fmt.Fprintln(w, "import (")
fmt.Fprintln(w, " \"fmt\"")
fmt.Fprintln(w, " \"os\"")
fmt.Fprintln(w, " \"sort\"")
fmt.Fprintln(w, " \"sync\"")
fmt.Fprintln(w, ")")
fmt.Fprintln(w, "")
fmt.Fprintln(w, "// bad global lock until I figure out some other plan")
fmt.Fprintln(w, "var godeplock sync.RWMutex")
fmt.Fprintln(w, "")
}