Go CLI Cheat Sheet/Print Go environment as JSON

Useful for scripting and debugging setup.

Section: Getting Started

Print Go environment as JSON

bash
bash
go env -json
Explanation

Useful for scripting and debugging setup. Useful in Go CLI workflows.

Learn the surrounding workflow

Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.

Related commands

Same sheet · prioritizing Getting Started
Print Go environment
Inspect Go environment variables and effective values.
OpenIn sheetbashsame section
Print Go version
Show the selected Go toolchain version.
OpenIn sheetbashsame section
Show help
Show top-level go command help.
OpenIn sheetbashsame section
Help for build
Show detailed help for go build flags and behavior.
OpenIn sheetbashsame section
Persist Go env value
Write a Go env default into the user config.
OpenIn sheetbash2 tag match
Unset persisted env value
Remove a persisted Go env setting.
OpenIn sheetbash2 tag match