2024-12-16 00:18:30 -06:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"io"
|
|
|
|
)
|
|
|
|
|
|
|
|
func headerComment(w io.Writer) {
|
2025-01-08 19:45:48 -06:00
|
|
|
// technically this should be the first line and in this exact format:
|
|
|
|
fmt.Fprintln(w, "// Code generated by go.wit.com/apps/autogenpb. DO NOT EDIT.")
|
2024-12-16 00:18:30 -06:00
|
|
|
fmt.Fprintln(w, "// This file was autogenerated with autogenpb", VERSION, "DO NOT EDIT")
|
|
|
|
fmt.Fprintln(w, "// go install go.wit.com/apps/autogenpb@latest")
|
|
|
|
fmt.Fprintln(w, "//")
|
|
|
|
fmt.Fprintln(w, "// You can use it on simple protobuf files")
|
|
|
|
fmt.Fprintln(w, "// The .proto file must have a singular and plural form of a message")
|
|
|
|
fmt.Fprintln(w, "// (for those of you that know ruby on rails, it's like that)")
|
|
|
|
fmt.Fprintln(w, "//")
|
|
|
|
fmt.Fprintln(w, "// You can mark which repos you want to auto generate sort.pb.go and marshal.pb.go files for")
|
|
|
|
fmt.Fprintln(w, "//")
|
|
|
|
fmt.Fprintln(w, "// For an example,")
|
|
|
|
fmt.Fprintln(w, "// go-clone go.wit.com/lib/protobuf/gitpb")
|
|
|
|
fmt.Fprintln(w, "//")
|
|
|
|
fmt.Fprintln(w, "")
|
|
|
|
}
|
|
|
|
|
2025-01-09 05:20:00 -06:00
|
|
|
func header(w io.Writer, pf *File) {
|
2025-01-08 19:45:48 -06:00
|
|
|
// header must come first
|
2024-12-16 00:18:30 -06:00
|
|
|
headerComment(w)
|
2025-01-09 05:20:00 -06:00
|
|
|
fmt.Fprintf(w, "package %s\n", pf.Package)
|
|
|
|
fmt.Fprintln(w, "")
|
2024-12-16 00:18:30 -06:00
|
|
|
fmt.Fprintln(w, "import (")
|
|
|
|
fmt.Fprintln(w, " \"fmt\"")
|
|
|
|
fmt.Fprintln(w, " \"sort\"")
|
|
|
|
fmt.Fprintln(w, " \"sync\"")
|
|
|
|
fmt.Fprintln(w, ")")
|
|
|
|
fmt.Fprintln(w, "")
|
|
|
|
}
|