diff options
author | Dmitri Shuralyov <dmitshur@golang.org> | 2018-09-12 13:58:18 -0400 |
---|---|---|
committer | Dmitri Shuralyov <dmitshur@golang.org> | 2018-09-18 22:11:45 +0000 |
commit | f2113d94c15dfa82d5afb46bc750f009284e2f64 (patch) | |
tree | 4bfb2569b93b45b5a6961b2deb05bfcb0c76c28a | |
parent | c9ca36fb70e88bfc48dc2ed599dfb688ec1fce21 (diff) | |
download | go-f2113d94c15dfa82d5afb46bc750f009284e2f64.tar.gz go-f2113d94c15dfa82d5afb46bc750f009284e2f64.zip |
[release-branch.go1.11] doc/go1.11, cmd/go: elaborate on new GOFLAGS environment variable
In Go 1.11, cmd/go gained support for the GOFLAGS environment variable.
It was added and described in detail in CL 126656.
Mention it in the Go 1.11 release notes, link to the cmd/go documentation,
and add more details there.
Fixes #27387.
Change-Id: Ifc35bfe3e0886a145478d36dde8e80aedd8ec68e
Reviewed-on: https://go-review.googlesource.com/135035
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Rob Pike <r@golang.org>
(cherry picked from commit 58c6afe075d74261dd67750e0aab5a1b8460839f)
Reviewed-on: https://go-review.googlesource.com/135496
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
-rw-r--r-- | doc/go1.11.html | 14 | ||||
-rw-r--r-- | src/cmd/go/alldocs.go | 6 | ||||
-rw-r--r-- | src/cmd/go/internal/help/helpdoc.go | 6 |
3 files changed, 26 insertions, 0 deletions
diff --git a/doc/go1.11.html b/doc/go1.11.html index afe1939766..16b4c904cb 100644 --- a/doc/go1.11.html +++ b/doc/go1.11.html @@ -348,6 +348,20 @@ updating. See the <a href="go1.10.html#cgo">Go 1.10 release notes</a> for details. <!-- CL 126275, CL 127156, CL 122217, CL 122575, CL 123177 --> </p> +<h3 id="go_command">Go command</h3> + +<p><!-- CL 126656 --> + The environment variable <code>GOFLAGS</code> may now be used + to set default flags for the <code>go</code> command. + This is useful in certain situations. + Linking can be noticeably slower on underpowered systems due to DWARF, + and users may want to set <code>-ldflags=-w</code> by default. + For modules, some users and CI systems will want vendoring always, + so they should set <code>-mod=vendor</code> by default. + For more information, see the <a href="/cmd/go/#hdr-Environment_variables"><code>go</code> + command documentation</a>. +</p> + <h3 id="godoc">Godoc</h3> <p> diff --git a/src/cmd/go/alldocs.go b/src/cmd/go/alldocs.go index ebbd154f3e..1060e779c1 100644 --- a/src/cmd/go/alldocs.go +++ b/src/cmd/go/alldocs.go @@ -1449,6 +1449,12 @@ // The directory where the go command will write // temporary source files, packages, and binaries. // +// Each entry in the GOFLAGS list must be a standalone flag. +// Because the entries are space-separated, flag values must +// not contain spaces. In some cases, you can provide multiple flag +// values instead: for example, to set '-ldflags=-s -w' +// you can use 'GOFLAGS=-ldflags=-s -ldflags=-w'. +// // Environment variables for use with cgo: // // CC diff --git a/src/cmd/go/internal/help/helpdoc.go b/src/cmd/go/internal/help/helpdoc.go index aff4ce12f6..e2c4e61615 100644 --- a/src/cmd/go/internal/help/helpdoc.go +++ b/src/cmd/go/internal/help/helpdoc.go @@ -507,6 +507,12 @@ General-purpose environment variables: The directory where the go command will write temporary source files, packages, and binaries. +Each entry in the GOFLAGS list must be a standalone flag. +Because the entries are space-separated, flag values must +not contain spaces. In some cases, you can provide multiple flag +values instead: for example, to set '-ldflags=-s -w' +you can use 'GOFLAGS=-ldflags=-s -ldflags=-w'. + Environment variables for use with cgo: CC |