Skip to content

Commit 58c6afe

Browse files
committed
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 #27282. Change-Id: Ifc35bfe3e0886a145478d36dde8e80aedd8ec68e Reviewed-on: https://go-review.googlesource.com/135035 Reviewed-by: Bryan C. Mills <[email protected]> Reviewed-by: Rob Pike <[email protected]>
1 parent 7df585d commit 58c6afe

File tree

3 files changed

+26
-0
lines changed

3 files changed

+26
-0
lines changed

doc/go1.11.html

+14
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,20 @@ <h3 id="cgo">Cgo</h3>
348348
details. <!-- CL 126275, CL 127156, CL 122217, CL 122575, CL 123177 -->
349349
</p>
350350

351+
<h3 id="go_command">Go command</h3>
352+
353+
<p><!-- CL 126656 -->
354+
The environment variable <code>GOFLAGS</code> may now be used
355+
to set default flags for the <code>go</code> command.
356+
This is useful in certain situations.
357+
Linking can be noticeably slower on underpowered systems due to DWARF,
358+
and users may want to set <code>-ldflags=-w</code> by default.
359+
For modules, some users and CI systems will want vendoring always,
360+
so they should set <code>-mod=vendor</code> by default.
361+
For more information, see the <a href="/cmd/go/#hdr-Environment_variables"><code>go</code>
362+
command documentation</a>.
363+
</p>
364+
351365
<h3 id="godoc">Godoc</h3>
352366

353367
<p>

src/cmd/go/alldocs.go

+6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/cmd/go/internal/help/helpdoc.go

+6
Original file line numberDiff line numberDiff line change
@@ -507,6 +507,12 @@ General-purpose environment variables:
507507
The directory where the go command will write
508508
temporary source files, packages, and binaries.
509509
510+
Each entry in the GOFLAGS list must be a standalone flag.
511+
Because the entries are space-separated, flag values must
512+
not contain spaces. In some cases, you can provide multiple flag
513+
values instead: for example, to set '-ldflags=-s -w'
514+
you can use 'GOFLAGS=-ldflags=-s -ldflags=-w'.
515+
510516
Environment variables for use with cgo:
511517
512518
CC

0 commit comments

Comments
 (0)