From b2492d16a01ff102b15dbe9cb1b20465e1cfeda0 Mon Sep 17 00:00:00 2001
From: Daniel Theophanes <kardianos@gmail.com>
Date: Sun, 6 Dec 2015 07:51:30 -0800
Subject: [PATCH] cmd/go: always show current value for GO15VENDOREXPERIMENT

Prior behavior would show empty string when unset. In go1.5 this
would result in "off". In go1.6 this will result in "on". This
change will make empty or "0" off and "1" on for go1.5 and go1.6.
Vendor tools can then rely on this value.

Discussion:
https://groups.google.com/forum/#!topic/golang-dev/oZzcXrlRrkA

Change-Id: I7e145a32e813dfde02dc262a9186c7af28db7b92
Reviewed-on: https://go-review.googlesource.com/17487
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
---
 src/cmd/go/env.go | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/cmd/go/env.go b/src/cmd/go/env.go
index 600accac03..24f612756b 100644
--- a/src/cmd/go/env.go
+++ b/src/cmd/go/env.go
@@ -33,6 +33,11 @@ func mkEnv() []envVar {
 	var b builder
 	b.init()
 
+	vendorExpValue := "0"
+	if go15VendorExperiment {
+		vendorExpValue = "1"
+	}
+
 	env := []envVar{
 		{"GOARCH", goarch},
 		{"GOBIN", gobin},
@@ -44,7 +49,7 @@ func mkEnv() []envVar {
 		{"GORACE", os.Getenv("GORACE")},
 		{"GOROOT", goroot},
 		{"GOTOOLDIR", toolDir},
-		{"GO15VENDOREXPERIMENT", os.Getenv("GO15VENDOREXPERIMENT")},
+		{"GO15VENDOREXPERIMENT", vendorExpValue},
 
 		// disable escape codes in clang errors
 		{"TERM", "dumb"},
-- 
2.30.9