Search⌘ K

Documenting Your Packages

Explore how to effectively document your Go packages using the go doc tool. Understand how to write proper comments for packages, types, and functions, generate readable documentation from your source code, and view it both in the command line and through a web server.

We'll cover the following...

The go doc tool also shows the comments in your package: the comments must start with // and precede the declarations (package, types, functions …) with no blank line in between. go doc will produce a series of Html-pages, one for each go file. For example:

  • In the folder doc_example we have the folders sort
...