go commands

10 commands, each with a one-line explanation. Click a command to copy it, or its title for details.

Commands 10 shown

  • GOOS=linux GOARCH=amd64 go build -o bin/app ./cmd/app

    Cross-compile a Go binary for Linux/amd64

    ci

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

    Run all tests with race condition detection enabled

    debug

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

    Generate HTML coverage report and open in browser

    debug

  • 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

    ci

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

    Run benchmarks, collect CPU profile, open pprof interactive UI

    debug · performance

  • go list ./...

    Print import paths of all packages in the module

  • gofmt -w .

    Reformat all .go files in the current tree

  • go vet ./...

    Report likely mistakes in Go source code

    debug