Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

go

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?

like image 336
Ali Dabour Avatar asked Oct 24 '25 12:10

Ali Dabour


1 Answers

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.

like image 194
apxp Avatar answered Oct 27 '25 02:10

apxp



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!