Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
x/tools/cmd/godoc: generate static docs #2381
It is fairly trivial to compile a given Go version and run the doc server locally to search for an older API. But it would be nice if golang.org provided access to docs per release. One simple solution to this is to add an option to godoc to generate static docs on disk -- just a tree of static files (search would be disabled of course). Then docs for old versions could be made available somewhere in golang.org. One additional benefit is that projects that want to ship docs could generate the static files and provide the html files for download, or create pdfs, chms etc based on them. PS: I tried searching for a similar issue; sorry if this is a duplicate.
I haven't thought about using wget. Nice. For those interested in this trick, here are some notes. First, edit robots.txt in the go root directory, and remove "Disallow: /". Otherwise only the index will be downloaded because wget respects robots.txt. Then start godoc pointing to the project path: godoc -path="/path/to/project" -http=:8080 And finally this a more complete command to get a working static docs, including static files and with proper links: wget -r -np -N -E -p -k http://localhost:8080/pkg/ -r : download recursive -np : don't ascend to the parent directory -N : don't retrieve files unless newer than local -E : add extension .html to html files (if they don't have) -p : download all necessary files for each page (css, js, images) -k : convert links to relative
changed the title from
cmd/godoc: generate static docs
x/tools/cmd/godoc: generate static docs
Apr 14, 2015
I would also like
I still want things like the builtins to link correctly to docs, so some incantation of
EDIT: Managed to do this in the end with a fairly noddy script.
referenced this issue
Feb 1, 2017
@dsnet Is this static generator available somewhere? I'd like to give it a try for hosting docs for a few packages.