Using Go has improved documentation at VSCO tenfold.
Never has a language made it so effortlessly fruitful to write and read
documentation. The secret: godoc.
Simply comment your functions, types, constants, variables, or anything
else you like, and read them with godoc
.
godoc
is a tool for fetching documentation for functions, variables,
types, etc. available in your GOROOT and GOPATH. It is easy to use on the
command line, but really shines when loaded up over HTTP:
$ godoc -http=:6060
Run that command and open https://localhost:6060 and you will be delighted by your own local copy of golang.org! Browse the documentation for any package in the standard library, or any project in your GOPATH.
VSCO commits any packages it writes to GitHub and, conveniently, they’re
all available under the top-level namespace of github.com/vsco
. Now our
developers can see all we have to offer by visiting
https://localhost:6060/pkg/github.com/vsco! Each package is named for the
service with which it interacts, so there’s no confusion.
godoc
has allowed us to write code with the client in mind: producing an
easy-to-use API with documentation to reduce confusion and duplication
of efforts. Write some documentation today!
On a Mac? Run the godoc server all the time without needing to open a terminal.
Happy documenting!