Creating Example Functions
Let’s learn how to create example functions.
We'll cover the following...
Part of the documentation process is generating example code that showcases the use of some or all the functions and data 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 checks whether the calculated output matches the values found after the ...