This is a small Go package that serves as an example for how to write, test, and document Go libraries. It is covered in detail in the article: "The anatomy of a Go project"
Package prime contains a helper function to check whether
an integer is prime. In the future, it may contain other
functions, but the API will remain backward-compatible.
package main
import (
"fmt"
"github.com/afshin/prime"
)
func main() {
var candidate uint64 = 5
if prime.IsPrime(candidate) {
fmt.Println("Five is prime.")
} else {
fmt.Println("Five is not prime.")
}
}