The Go testing package supports automated tests, failure reporting, command-line execution, code coverage, and race-condition detection. Test files end in _test.go, so Go runs them during testing but excludes them from application builds. section 1.2.4
A practical testing workflow:
- Define a function whose name begins with Test and accept a *testing.T value for reporting failures. section 1.2.4
- Run go test for the current package or go test ./... for the package tree. section 1.2.4
Detecting a Unicode reversal bug
A test reverses names and compares actual and expected values with strings.EqualFold. The failure exposes byte-wise reversal of a multibyte character; converting the string to []rune fixes the implementation, after which go test reports PASS.

