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

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

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

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