package.json: add go.terminal.activateEnvironment setting

The Go extension attempts to add the path to the chosen Go binary
(typically, $GOROOT/bin) to the PATH or Path environment variable
used in the integrated terminal - to help users pick up the same
Go binary the extension uses when they run 'go' from the integrated
terminal.

Some users however report this default behavior interferes with
other Go version manamange systems or their shell setup.

This new `go.terminal.activateEnvironment` setting allows users
to disable the default behavior. The default is true to preserve
the current default behavior.

Unfortunately, there is no test - this code path was hard to test
reliably.

Fixes golang/vscode-go#1558
Fixes golang/vscode-go#1098

Change-Id: Ic35b11c47f9393655e6b3e37b12c369a37b56132
Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/336409
Trust: Hyang-Ah Hana Kim <hyangah@gmail.com>
Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
Reviewed-by: Suzy Mueller <suzmue@golang.org>
diff --git a/docs/settings.md b/docs/settings.md
index 0922d7a..993bb74 100644
--- a/docs/settings.md
+++ b/docs/settings.md
@@ -382,6 +382,11 @@
 	"tags" :	"",
 }
 ```
+### `go.terminal.activateEnvironment`
+
+Apply the Go & PATH environment variables used by the extension to all integrated terminals.
+
+Default: `true`
 ### `go.testEnvFile`
 
 Absolute path to a file containing environment variables definitions. File contents should be of the form key=value.
diff --git a/package.json b/package.json
index 458a96d..af8d4f9 100644
--- a/package.json
+++ b/package.json
@@ -1819,6 +1819,12 @@
           },
           "additionalProperties": true
         },
+        "go.terminal.activateEnvironment": {
+          "default": true,
+          "description": "Apply the Go & PATH environment variables used by the extension to all integrated terminals.",
+          "scope": "resource",
+          "type": "boolean"
+        },
         "gopls": {
           "type": "object",
           "markdownDescription": "Configure the default Go language server ('gopls'). In most cases, configuring this section is unnecessary. See [the documentation](https://github.com/golang/tools/blob/master/gopls/doc/settings.md) for all available settings.",
diff --git a/src/goEnvironmentStatus.ts b/src/goEnvironmentStatus.ts
index 2262aa6..5958329 100644
--- a/src/goEnvironmentStatus.ts
+++ b/src/goEnvironmentStatus.ts
@@ -323,6 +323,10 @@
 	if (!newGoRuntimeBase) {
 		return;
 	}
+	const goCfg = getGoConfig();
+	if (!goCfg.get('terminal.activateEnvironment')) {
+		return;
+	}
 	const pathEnvVar = pathEnvVarName();
 	if (!pathEnvVar) {
 		logVerbose("couldn't find PATH property in process.env");