1
0
mirror of https://github.com/golang/go synced 2024-11-07 15:46:23 -07:00
go/src
Russ Cox c1a4fc3b36 cmd/go: add $GOFLAGS environment variable
People sometimes want to turn on a particular go command flag by default.
In Go 1.11 we have at least two different cases where users may need this.

1. Linking can be noticeably slower on underpowered systems
due to DWARF, and users may want to set -ldflags=-w by default.

2. For modules, some users or CI systems will want vendoring always,
so they want -getmode=vendor (soon to be -mod=vendor) by default.

This CL generalizes the problem to “set default flags for the go command.”

$GOFLAGS can be a space-separated list of flag settings, but each
space-separated entry in the list must be a standalone flag.
That is, you must do 'GOFLAGS=-ldflags=-w' not 'GOFLAGS=-ldflags -w'.
The latter would mean to pass -w to go commands that understand it
(if any do; if not, it's an error to mention it).

For #26074.
For #26318.
Fixes #26585.

Change-Id: I428f79c1fbfb9e41e54d199c68746405aed2319c
Reviewed-on: https://go-review.googlesource.com/126656
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
2018-08-01 00:35:21 +00:00
..
archive
bufio
builtin
bytes
cmd cmd/go: add $GOFLAGS environment variable 2018-08-01 00:35:21 +00:00
compress
container
context
crypto crypto/x509: skip TestSystemRoots 2018-07-27 16:44:57 +00:00
database/sql
debug
encoding
errors
expvar
flag
fmt
go go/doc: do not treat methods as test functions 2018-07-31 16:11:48 +00:00
hash
html html: lazily populate Unescape tables 2018-07-31 22:10:54 +00:00
image
index/suffixarray
internal
io
log
math
mime
net net/http: revert CL 89275 (don't sniff Content-Type when nosniff set) 2018-07-31 17:29:58 +00:00
os
path path: present the correct error message in TestMatch 2018-07-29 19:18:48 +00:00
plugin
reflect
regexp
runtime syscall: improve NewCallback documentation and panic message 2018-07-27 17:42:58 +00:00
sort
strconv
strings
sync
syscall syscall: remove support for O_NONBLOCK and O_SYNC on js/wasm 2018-07-31 17:03:39 +00:00
testing
text
time
unicode
unsafe
vendor/golang_org/x
all.bash
all.bat
all.rc
androidtest.bash
bootstrap.bash
buildall.bash
clean.bash
clean.bat
clean.rc
cmp.bash
iostest.bash
make.bash cmd/go: add $GOFLAGS environment variable 2018-08-01 00:35:21 +00:00
make.bat cmd/go: add $GOFLAGS environment variable 2018-08-01 00:35:21 +00:00
Make.dist
make.rc cmd/go: add $GOFLAGS environment variable 2018-08-01 00:35:21 +00:00
naclmake.bash
nacltest.bash
race.bash
race.bat
run.bash cmd/go: add $GOFLAGS environment variable 2018-08-01 00:35:21 +00:00
run.bat cmd/go: add $GOFLAGS environment variable 2018-08-01 00:35:21 +00:00
run.rc cmd/go: add $GOFLAGS environment variable 2018-08-01 00:35:21 +00:00