How can I generate HTML documents using `godoc`?

A simple HTML documentation can be produced by, for example:

$ godoc -html container/heap Interface > page.html

A bit better form can by produced by:

$ godoc -url "http://localhost:6060/pkg/container/heap/" > page.html 

(I have godoc server running at :6060 and I'm not sure if that's a prerequisite).

The HTML would probably look better if combined with original CSS styles found in the Go repository by adjusting the produced HTML files to properly refer to it.


This might not directly answer your question, but if you are planning to open source your project, you don't really have to generate HTML manually. Just make sure you have comments properly inserted in your source code, and use godoc.org( http://godoc.org/-/about ) to handle it.

It displays documentation for Go packages on Bitbucket, Github, Launchpad and Google Project Hosting.

Check this out for example: http://godoc.org/code.google.com/p/go.crypto/ssh


Run the server and get it with wget

godoc -http=:6060

wait for it to start up then ("container/heap/" with your app):

wget -p -k http://localhost:6060/pkg/container/heap/

To download all docs I use following:

wget -m -k -q -erobots=off --no-host-directories --no-use-server-timestamps http://localhost:6060

Tags:

Go