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