From c1a4fc3b36ccfe0022392224c2630f7971c156fe Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Sun, 29 Jul 2018 01:10:02 -0400 Subject: cmd/go: add $GOFLAGS environment variable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 TryBot-Result: Gobot Gobot Reviewed-by: Rob Pike --- src/make.bash | 1 + 1 file changed, 1 insertion(+) (limited to 'src/make.bash') diff --git a/src/make.bash b/src/make.bash index a28b82a058..78882d9834 100755 --- a/src/make.bash +++ b/src/make.bash @@ -63,6 +63,7 @@ set -e unset GOBIN # Issue 14340 +unset GOFLAGS if [ ! -f run.bash ]; then echo 'make.bash must be run from $GOROOT/src' 1>&2 -- cgit v1.2.1