Format all code

Reformat all .go files in the current tree

gofmt -w .

tool
go10 commands
tags
go

More go commands

  • go vet ./...

    Report likely mistakes in Go source code

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

    Cross-compile a Go binary for Linux/amd64

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

    Run all tests with race condition detection enabled

  • 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

all 10 go commands