5

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.

ahajib
  • 12,838
  • 29
  • 79
  • 120
jim
  • 8,670
  • 15
  • 78
  • 149
  • 1
    Maybe [`godocdowm`](https://github.com/robertkrimen/godocdown) + some converter like `pandoc` could work for you? – kostix Jul 18 '16 at 19:11

1 Answers1

2

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.

Adrian
  • 42,911
  • 6
  • 107
  • 99
  • 2
    this answer only says, that there is no way of packaging "sub packages" into one file. But what about the "dead links" to other packages (trying to avoid calling them sub packages)? There must be a way to create a documentation page(s) for all the packages I created with references between the packages!? – TehSphinX Jul 13 '16 at 14:39