go

How can I generate HTML documents using `godoc`?


I have written a small go program, and I want to generate standalone HTML documents from source code that can be viewed without godoc server. But I can't find any way to achieve it. if anyone could help me, I'll appreciate it.


Solution

  • 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.