How can I generate HTML documents using `godoc`?

后端 未结 4 519
一生所求
一生所求 2021-01-31 01:53

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 achiev

4条回答
  •  佛祖请我去吃肉
    2021-01-31 02:17

    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.

提交回复
热议问题