prime

package module
v0.0.0-...-e28680c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 29, 2015 License: MIT Imports: 0 Imported by: 0

README

prime

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"

Install

go get github.com/afshin/prime

Test

go test -cover github.com/afshin/prime

Documentation

API documentation

Test coverage

Coverage status

Documentation

Overview

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.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsPrime

func IsPrime(candidate uint64) bool

IsPrime checks if candidate is a prime number.

Example
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.")
	}
}
Output:

Five is prime.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL