Pattern: Common mistaken usage of tests/documentation
Issue: -
To fully use automated testing of Go packages you should apply naming and signature conventions for Test
, Benchmark
and Example
functions. This rule checks for malformed names, wrong signatures and examples documenting inexistent identifiers.
Example of incorrect code:
func Examplesalutations() {
fmt.Println("hello, and")
fmt.Println("goodbye")
}
Example of correct code:
func ExampleSalutations() {
fmt.Println("hello, and")
fmt.Println("goodbye")
}