add header to the generated output
This commit is contained in:
parent
e2747666f9
commit
b092c9cb4c
@ -21,6 +21,12 @@ import (
|
||||
"strings"
|
||||
)
|
||||
|
||||
const header = `/*
|
||||
Generated by https://code.squareroundforest.org/arpio/docreflect
|
||||
*/
|
||||
|
||||
`
|
||||
|
||||
type options struct {
|
||||
wd string
|
||||
goroot string
|
||||
@ -600,6 +606,7 @@ func format(w io.Writer, pname string, docs map[string]string) error {
|
||||
_, err = fmt.Fprintln(w, a...)
|
||||
}
|
||||
|
||||
println(header)
|
||||
printf("package %s\n", pname)
|
||||
println("import \"code.squareroundforest.org/arpio/docreflect\"")
|
||||
println("func init() {")
|
||||
|
@ -404,12 +404,12 @@ func TestFormat(t *testing.T) {
|
||||
}
|
||||
|
||||
o := b.String()
|
||||
if o != `package testpackage
|
||||
if !strings.Contains(o, `package testpackage
|
||||
import "code.squareroundforest.org/arpio/docreflect"
|
||||
func init() {
|
||||
docreflect.Register("baz", "qux")
|
||||
docreflect.Register("foo", "bar")
|
||||
}` {
|
||||
t.Fatal()
|
||||
}`) {
|
||||
t.Fatal(o)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user