Offline Go documentation

Go also comes with offline documentation with the godoc command-line tool. You can use it on the command line, or have it run a web server where it serves the same website that https://golang.org/ hosts. It is quite handy to have the full website documentation available locally. Here are a few examples that get documentation for the fmt package. Replace fmt with whatever package you are interested in:

 # Get fmt package information godoc fmt # Get source code for fmt package godoc -src fmt # Get specific function information godoc fmt Printf # Get source code for function godoc -src fmt Printf # Run HTTP server to view HTML documentation godoc -http=localhost:9999
  

The HTTP option serves the same documentation that ...

Get Security with Go now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.