It seems that the godoc
tool is not Go modules aware.
A simple godoc -goroot=.
serves the project files, but it does not generate documentation for the packages. I tested it from withing the projects source directory, where also the go.mod
and go.sum
module files are stored.
How to generate documentation for all packages inside a Go module - outside of $GOPATH
?
In the release notes of Go 1.12 is written that the godoc
tool will not be included in future Go releases and will only be available via go get
after Go 1.12. One should use the Go go doc
command. However, go doc
does not generate "nice to read" HTML pages. Is there an alternative for documentation generation from Go source code which outputs HTML or Markdown?
-goroot
at your source. GOROOT should be pointing at your Go installation. Also to the last part of your question, requests for third-party tools and libraries are off-topic for Stack Overflow. – Jeanmariejeanna