The testing package

Tests ship with the language

In Part I you leaned on Xcode's test target. Go needs no target, no framework, and no dependency: the standard library ships a testing package, and the go test command runs it. Write a function that starts with Test, and Go finds it and runs it.

Tests live in files named _test.go next to the code they exercise. If you're testing price.go in package walker, you write price_test.go in the same package β€” it can see unexported helpers and all. Those _test.go files are invisible to a normal go build; they only compile when you run go test.