To exclude all the tests and just run the benchmarks:

go test -run=^$ -bench=.

Profile:

go test -cpuprofile=cpu.out -benchmem -memprofile=mem.out -run=^$ -bench=

Using pprof:

CPU:

go tool pprof <your-binary>.test cpu.out

MEM:

go tool pprof -alloc_objects <your-binary>.test mem.out

Go Tooling in Action

{{< youtube uBjoTxosSys>}}