Examples

Go is very focused on proper documentation, and sample code adds another dimension to both documentation and testing.

Your examples should show users how to use a specific piece of code.


> go test -v

// Output:
=== RUN   TestAdd
--- PASS: TestAdd (0.00s)
=== RUN   ExampleAdd
--- PASS: ExampleAdd (0.00s)
PASS
ok      ./math   0.442s
                        
examples.go