go-env
print and manage Go environment variables
TLDR
Print all Go environment variables
$ go env
Print specific variable$ go env GOPATH
Print multiple variables$ go env GOROOT GOPATH GOBIN
Set a variable persistently$ go env -w GOBIN=[/path/to/bin]
Unset a variable$ go env -u GOBIN
Print as JSON$ go env -json
SYNOPSIS
go env [-json] [-u var] [-w var=value] [var ...]
DESCRIPTION
go env prints Go environment information. Without arguments, it prints all known environment variables. With arguments, it prints the values of the named variables. The -w flag writes values to the go/env file, making them persistent across sessions. The -u flag removes variables from go/env.
PARAMETERS
-json
Print environment in JSON format.-w var=value
Set variable persistently in go/env file.-u var
Unset variable from go/env file.
CONFIGURATION
$HOME/.config/go/env
Persistent Go environment variable file managed by go env -w.
CAVEATS
Variables set with -w take precedence over shell environment variables. The go/env file is typically located at $HOME/.config/go/env.
