Godoc,为整个程序包创建html [英] Godoc, create html for entire package

查看:70
本文介绍了Godoc,为整个程序包创建html的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用godoc为整个程序包创建html文档.即递归地在我跑步的那一刻:

How can I use godoc to create html documentation for an entire package. i.e. recursively. At the moment when I run:

godoc -html -goroot="mypath" pkg > index.html

我刚得到一个index.html,其中包含有关当前目录中.go文件的信息.

I just get an index.html that contains information on the .go files in the current directory.

没有其他子软件包的文档,但index.html确实包含了它们的无效链接.

There is no documentation for the other sub packages but the index.html does include dead links for them.

如何以递归方式运行上述命令?也许我错过了一些东西,因为godoc文档中没有提到递归.

How can I run the above command in a recursive fashion? Perhaps I am missing something because there is no mention of recursion in the godoc documentation.

推荐答案

Go实际上没有子包"的概念-所有包都是包,如文件顶部的包声明所示,不是有任何等级制度.将嵌套子目录的所有文档打包到一个文件中是不习惯的-由于子目录包含不同的软件包,因此文档应该是分开的.

Go has no notion of "sub packages" in reality - all packages are just packages, as you can tell by the package declaration at the top of the file not having any hierarchy. It would be unidiomatic to package all documentation for nested subdirectories into a single file - as the subdirectories contain different packages, the documentation should be separate.

这篇关于Godoc,为整个程序包创建html的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆