Golang environments: Difference between revisions

From wikinotes
(Created page with "= Documentation = <blockquote> {| class="wikitable" |- | environment variables || https://pkg.go.dev/cmd/go#hdr-Environment_variables |- |} </blockquote><!-- Documentation -->...")
 
No edit summary
Line 7: Line 7:
|}
|}
</blockquote><!-- Documentation -->
</blockquote><!-- Documentation -->
=== Locations ===
<blockquote>
{| class="wikitable"
|-
| <code>~/.config/go/env</code> || 'go env' set environment variables
|-
|}
</blockquote><!-- Locations -->


= Environment Variables =
= Environment Variables =
Line 22: Line 31:
= Go Env =
= Go Env =
<blockquote>
<blockquote>
<code>go env</code> lets you set/persist go environment variables.<br>
They will be loaded in new shells automatically.
<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
go env -w GOBIN=/foo/bar/bin  # set default envvar val within environment
go env -w GOBIN=/foo/bar/bin  # set default envvar val within environment

Revision as of 02:15, 19 June 2022

Documentation

environment variables https://pkg.go.dev/cmd/go#hdr-Environment_variables

Locations

~/.config/go/env 'go env' set environment variables

Environment Variables

A small subset of useful environment variables.

GOPATH=
GOBIN=

GOPRIVATE=
GOPROXY=

Go Env

go env lets you set/persist go environment variables.
They will be loaded in new shells automatically.

go env -w GOBIN=/foo/bar/bin  # set default envvar val within environment
go env -u GOBIN               # unset environment variable set by 'go env'