HiveBrain v1.2.0
Get Started
← Back to all entries
snippetbashTip

go env — Manage environment variables used by the Go toolchain. More information: <https://pkg.go.dev/cmd/go#

Submitted by: @import:tldr-pages··
0
Viewed 0 times
thecommandusedclimanageenvironmentgo envvariables

Problem

How to use the go env command: Manage environment variables used by the Go toolchain. More information: <https://pkg.go.dev/cmd/go#hdr-Print_Go_environment_information>.

Solution

go env — Manage environment variables used by the Go toolchain. More information: <https://pkg.go.dev/cmd/go#hdr-Print_Go_environment_information>.

Show all environment variables:
go env


Show a specific environment variable:
go env {{GOPATH}}


Set an environment variable to a value:
go env -w {{GOBIN}}={{path/to/directory}}


Reset an environment variable's value:
go env -u {{GOBIN}}

Code Snippets

Show all environment variables

go env

Show a specific environment variable

go env {{GOPATH}}

Set an environment variable to a value

go env -w {{GOBIN}}={{path/to/directory}}

Reset an environment variable's value

go env -u {{GOBIN}}

Context

tldr-pages: common/go env

Revisions (0)

No revisions yet.