See Examples for information on how example functions are named.
The example ExampleMain
refers to the identifier Main
.
The go test
command runs the go vet
command. The go vet
command reports an error because the package does not have an identifier named Main
.
Fix by associating the example with an exported identifier or the package.
In the following code, the example is associated with the package and has the suffix "jasmine".
package main
func Example_jasmine() {
main()
//Output: Hello, world!
}