NOTE: this is simple bloody PoC (!) to generate a static documentation for golang packages stored in Github organization.
pkgsite could be too powerful for some use cases. doc2go could be a choice though:
- assumes golang dependency on the target machine (to retrieve all dependencies via
go get) - requires manual adjustments (including manual main
index.htmlmerge) when documentation for unrelated packages is generated one by one
A glue code for go2doc which:
- clones a target package and retrieves all its dependencies (no
godependency) - runs for target packages and theirs dependencies and produces an index file
yq: to be downloaded by the PoC if missing)doc2go: is expected to be already available in$PATH
- Adjust
config.yml - Ensure
www-root-dirfrom config is created/existent - Run
./godoc.shto generate documentation accordingly to the config - Run webserver against
www-root-dirto see the documentation
Given that the repo has been cloned as is, make smoke-test should perform the steps above for you.
Default config.yml targets against certain awesome Hashicorp masterpieces.
git clonepackages listed in the config. The corresponding dependencies (using entries fromgo.sum) are retrieved in DFS way as well. If some packages are already available locally, they aregit pulled. Done mostly in gomod-deps helper.doc2gois applied against the each package cloned. All references to packages from the same Github organization are preserved (instead of using defaultpkg.go.devURL)- Single main
index.htmlfor all packages processed is produced
Since this is proof of concept only, more likely there is no further maintainenace is assumed: you use it on your own risk & responsibility. And usage of shell scripting for this PoC wasn't the best idea ever 😃 but efforts consuming.
