These packages existed only to power cmd/godoc for the purpose of serving the golang.org website. That functionality has moved into x/website as part of golang/go#29206. x/website has become the canonical source of golang.org in CL 162157, the golang.org-serving code was removed from cmd/godoc in CL 162400, and these packages can be deleted too now. This removes the last dependency on the cloud.google.com/go module, which results in a significant reduction of the number of indirect dependencies in x/tools (this is due to issue golang/go#29935, which affects the current version of the cloud.google.com/go module). Run go mod tidy (using Go 1.12 RC 1). Updates golang/go#29206 Updates golang/go#29981 Change-Id: If07e3ccae8538b3ebd51af64b6af5be5463f4906 Reviewed-on: https://go-review.googlesource.com/c/162401 Reviewed-by: Bryan C. Mills <bcmills@google.com> Reviewed-by: Channing Kimble-Brown <channing@golang.org> Reviewed-by: Michael Matloob <matloob@golang.org>
godoc
This directory contains most of the code for running a godoc server. The executable lives at golang.org/x/tools/cmd/godoc.
Development mode
In production, CSS/JS/template assets need to be compiled into the godoc binary. It can be tedious to recompile assets every time, but you can pass a flag to load CSS/JS/templates from disk every time a page loads:
godoc -templates=$GOPATH/src/golang.org/x/tools/godoc/static -http=:6060
Recompiling static assets
The files that live at static/style.css
, static/jquery.js
and so on are not
present in the final binary. They are placed into static/static.go
by running
go generate
. So to compile a change and test it in your browser:
-
Make changes to e.g.
static/style.css
. -
Run
go generate golang.org/x/tools/godoc/static
sostatic/static.go
picks up the change. -
Run
go install golang.org/x/tools/cmd/godoc
so the compiledgodoc
binary picks up the change. -
Run
godoc -http=:6060
and view your changes in the browser. You may need to disable your browser's cache to avoid reloading a stale file.