Skip to content

Commit 0c0ef67

Browse files
committed
[release] src/goEnv.ts: readd go.toolsEnvVars variable substitution
The extension resolved ${workspaceFolder}, ${workspaceRoot}, ${env:} variables included in go.toolsEnvVars, since 0.6.66, but that feature was lost in the 0.15 dev cycle. Readd the code from https://github.com/microsoft/vscode-go/blob/2dbccbe5d2fb70feab3f87ac6f6187f6b896e795/src/util.ts#L438 Similar logic for testEnvVars still exists in getTestEnvVars (testutils.ts). Fixes #413 Change-Id: I1cc8ff41ce8445c573e554f947da8cd610c3671b Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/246519 Reviewed-by: Rebecca Stambler <[email protected]> (cherry picked from commit 6a84918) Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/246958 Reviewed-by: Hyang-Ah Hana Kim <[email protected]>
1 parent 265bf23 commit 0c0ef67

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/goEnv.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
import path = require('path');
99
import vscode = require('vscode');
10-
import { getCurrentGoPath, getGoConfig, getToolsGopath } from './util';
10+
import { getCurrentGoPath, getGoConfig, getToolsGopath, resolvePath } from './util';
1111

1212
// toolInstallationEnvironment returns the environment in which tools should
1313
// be installed. It always returns a new object.
@@ -56,6 +56,13 @@ export function toolExecutionEnvironment(): NodeJS.Dict<string> {
5656
function newEnvironment(): NodeJS.Dict<string> {
5757
const toolsEnvVars = getGoConfig()['toolsEnvVars'];
5858
const env = Object.assign({}, process.env, toolsEnvVars);
59+
if (toolsEnvVars && typeof toolsEnvVars === 'object') {
60+
Object.keys(toolsEnvVars).forEach(
61+
(key) =>
62+
(env[key] =
63+
typeof toolsEnvVars[key] === 'string' ? resolvePath(toolsEnvVars[key]) : toolsEnvVars[key])
64+
);
65+
}
5966

6067
// The http.proxy setting takes precedence over environment variables.
6168
const httpProxy = vscode.workspace.getConfiguration('http', null).get('proxy');

0 commit comments

Comments
 (0)