Tests
Basic test run:
go test ./... -v
Prettier output using gotestsum
:
go run gotest.tools/gotestsum@latest
Coverage
Generate a coverage profile:
go test -coverpkg=./... -coverprofile=cover.out ./...
View the data:
go tool cover -func cover.out
go tool cover -html cover.out
Benchmarks
Run all benchmarks:
go test ./tests -run='^$' -bench=. -benchmem
Examples only:
go test ./tests -run='^$' -bench=Examples/ -benchmem
Profiling
Generate a profile:
go test ./tests -run='^$' -bench=Examples/ -benchmem -cpuprofile cpu.out -memprofile mem.out
View the data:
go tool pprof --nodefraction=0.1 -http=:8080 ./cpu.out
go tool pprof --nodefraction=0.1 -http=:8080 ./mem.out