dousuize3082
2012-11-23 13:28
浏览 258
已采纳

如何使用`godoc`生成HTML文档?

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.

图片转代码服务由CSDN问答提供 功能建议

我编写了一个小型go程序,我想从源代码生成独立的HTML文档,而无需查看即可 godoc服务器。 但是我找不到任何方法来实现它。 如果有人可以帮助我,我将不胜感激。

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

3条回答 默认 最新

  • doutinghou6980 2012-11-23 13:42
    最佳回答

    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.

    评论
    解决 无用
    打赏 举报
查看更多回答(2条)

相关推荐 更多相似问题