Run tests with race detector

Run all tests with race condition detection enabled

go test -race -count=1 ./...

tool
go10 commands
tags
godebug

More go commands

  • go test -coverprofile=cov.out ./... && go tool cover -html=cov.out

    Generate HTML coverage report and open in browser

  • go get github.com/some/pkg@v1.2.3

    Download a specific module version and update go.mod

  • go mod tidy

    Add missing and remove unused module dependencies

  • go mod vendor

    Copy all module dependencies into the vendor/ directory

  • go test -cpuprofile=cpu.prof -bench=. ./... && go tool pprof cpu.prof

    Run benchmarks, collect CPU profile, open pprof interactive UI

all 10 go commands