I am using godocs to document my API written in go/golang and I am documenting it using godocs in the sense that I generate an HTML page of my entire main.go file which contains all the functions used to create my API. However, I do not want to display information about all my helper functions, I just want to display header information about some functions in the file. Is there a way to only allow some of the functions in the file to be part of the documentation or do I have to create another file for all my helper functions?
Right now I am testing it on my local port 8000: godoc -http=:8000
The default behavior of the commands godoc and its cousin go doc, display package documentation of exported declarations. Oddly I did not find a simple authoritative source to link to that explicitly documents this fact, but there are inferences to that fact referenced in commands that alter the default behavior, such as from the godoc package's documentation:
The presentation mode of web pages served by godoc can be controlled with the "m" URL parameter; it accepts a comma-separated list of flag names as value:
...
For instance, http://golang.org/pkg/math/big/?m=all,text shows the documentation for all (not just the exported) declarations of package big, in textual form (as it would appear when using godoc from the command line: "godoc -src math/big .*").
And the source code at https://golang.org/src/go/doc/doc.go which includes:
81 const (
82 // extract documentation for all package-level declarations,
83 // not just exported ones
84 AllDecls Mode = 1 << iota
...
89 )
And https://golang.org/src/go/doc/exports.go documents a function with:
241 // fileExports removes unexported declarations from src in place.
And finally running go doc -h
in the terminal reveals a flag:
-u show unexported symbols as well as exported.