31 lines
731 B
Go
31 lines
731 B
Go
|
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, "")
|
||
|
}
|