August 2019
Beginner to intermediate
798 pages
17h 2m
English
Part of the documentation process is generating example code that showcases the use of some or all of the functions and types of a package. Example functions have many benefits, including the fact that they are executable tests that are executed by go test. Therefore, if an example function contains an // Output: line, the go test tool will check whether the calculated output matches the values found after the // Output: line.
Additionally, examples are really useful when seen in the documentation of the package, which is the subject of the next section. Finally, example functions that are presented on the Go documentation server (https://golang.org/pkg/io/#example_Copy) allow the reader of the documentation to ...
Read now
Unlock full access