go versionShow the selected Go toolchain version. Useful in Go CLI workflows.
Core go command workflows for build, run, test, env, fmt, vet, doc, install, list, clean, toolchains, and everyday module-aware development.
Getting Started commands and patterns for the Go command.
go versionShow the selected Go toolchain version. Useful in Go CLI workflows.
go envInspect Go environment variables and effective values. Useful in Go CLI workflows.
go env -jsonUseful for scripting and debugging setup. Useful in Go CLI workflows.
go helpShow top-level go command help. Useful in Go CLI workflows.
go help buildShow detailed help for go build flags and behavior. Useful in Go CLI workflows.
Run Build Install commands and patterns for the Go command.
go run .Compile and run the current module entrypoint. Useful in Go CLI workflows.
go run main.goCompile and run a single Go source file. Useful in Go CLI workflows.
go build .Compile the current package or module target. Useful in Go CLI workflows.
go build -o ./bin/app .Write the compiled binary to a specific path. Useful in Go CLI workflows.
go install ./cmd/myappCompile and install a package binary. Useful in Go CLI workflows.
go install golang.org/x/tools/cmd/stringer@latestInstall a tool at an explicit module version. Useful in Go CLI workflows.
Formatting and Quality commands and patterns for the Go command.
go fmt ./...Run gofmt across package sources. Useful in Go CLI workflows.
go vet ./...Report likely mistakes in Go packages. Useful in Go CLI workflows.
go test -short ./...Run tests while skipping long-running cases. Useful in Go CLI workflows.
go test -race ./...Detect race conditions in tests or packages. Useful in Go CLI workflows.
go test -cover ./...Collect statement coverage while testing. Useful in Go CLI workflows.
Documentation and Listing commands and patterns for the Go command.
go doc net/httpPrint docs for a package. Useful in Go CLI workflows.
go doc net/http ClientPrint docs for a symbol in a package. Useful in Go CLI workflows.
go list ./...List packages under the current module. Useful in Go CLI workflows.
go list -json ./...Emit package metadata for scripts and tooling. Useful in Go CLI workflows.
go clean -cache -testcache -modcacheRemove build outputs and cached files. Useful in Go CLI workflows.
Toolchains and Env commands and patterns for the Go command.
go env -w GOPRIVATE=github.com/myorg/*Write a Go env default into the user config. Useful in Go CLI workflows.
go env -u GOPRIVATERemove a persisted Go env setting. Useful in Go CLI workflows.
GOTOOLCHAIN=local go test ./...Run with the bundled/local toolchain only. Useful in Go CLI workflows.
Let the go command choose a newer toolchain if needed.
GOTOOLCHAIN=auto go versionLet the go command choose a newer toolchain if needed. Useful in Go CLI workflows.
go tool compile -helpPass through to tool-specific options when needed. Useful in Go CLI workflows.