gogodoc

How can I generate HTML documents for all packages inside a folder using godoc


godoc -html generates documents for only one package. However, I want to ship the project with all documents for all packages, just like when I run godoc -http. With that, I could find all packages and navigate through them from the browser.

Is it possible to generate HTML pages for all packages linked together through godoc -html?


Solution

  • You have two questions here:

    Is it possible to generate HTML pages for all packages linked together through godoc -html?

    No. Because it is not implemented into godoc (https://godoc.org/golang.org/x/tools/cmd/godoc).

    The other question:

    How can I generate HTML documents for all packages inside a folder using godoc

    I think the simplest way is to start godoc with the http flag: godoc -http=:6060

    Then you navigate to the folder you want to get the docs. For that url you can use a webcrawler for getting the html documentation. There are already some crawler in Go (https://godoc.org/?q=crawler), if you don't want to write a crawler by your own.