Commit 1ed932d2 authored by Daniel Martí's avatar Daniel Martí
Browse files

cmd/go: refuse -w with an invalid GO111MODULE

It was possible to get 'go env' to break itself:

	$ go env -w GO111MODULE=bad
	$ go env
	go: unknown environment setting GO111MODULE=bad

We already check if the variable name is known. In some cases like
GO111MODULE, we also know what the variable's valid values are. Enforce
it when writing the variable, not just when fetching it.

Fixes #34880.

Change-Id: I10d682087c69f3445f314fd4473644f694e255f7
Reviewed-on: https://go-review.googlesource.com/c/go/+/200867


Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: default avatarJay Conrod <jayconrod@google.com>
Reviewed-by: default avatarBryan C. Mills <bcmills@google.com>
parent 90888ed9
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment