2025-03-14 21:59:59 -06:00
# go test
2026-02-18 06:55:01 -07:00
> Test Go packages (files have to end with `_test.go`).
2026-07-08 16:22:34 -06:00
> Note: `./...` is a Go package pattern understood by Go tooling. It matches the current package and all packages recursively under the current directory.
2025-03-14 21:59:59 -06:00
> More information: <https://pkg.go.dev/cmd/go#hdr-Testing_flags>.
- Test the package found in the current directory:
`go test`
- [v]erbosely test the package in the current directory:
`go test -v`
2026-07-08 16:22:34 -06:00
- Test the packages in the current directory and all subdirectories:
2025-03-14 21:59:59 -06:00
`go test -v ./...`
- Test the package in the current directory and run all benchmarks:
`go test -v -bench .`
- Test the package in the current directory and run all benchmarks for 50 seconds:
2025-12-16 10:20:31 -07:00
`go test -v -bench . -benchtime 50s`
2025-03-14 21:59:59 -06:00
- Test the package with coverage analysis:
`go test -cover`