@@ -11,7 +11,7 @@ import path = require('path');
11
11
import { SemVer } from 'semver' ;
12
12
import util = require( 'util' ) ;
13
13
import vscode = require( 'vscode' ) ;
14
- import { toolInstallationEnvironment } from './goEnv' ;
14
+ import { toolExecutionEnvironment , toolInstallationEnvironment } from './goEnv' ;
15
15
import { addGoRuntimeBaseToPATH , initGoStatusBar } from './goEnvironmentStatus' ;
16
16
import { getLanguageServerToolPath } from './goLanguageServer' ;
17
17
import { restartLanguageServer } from './goMain' ;
@@ -32,6 +32,7 @@ import {
32
32
getGoConfig ,
33
33
getGoVersion ,
34
34
getTempFilePath ,
35
+ getWorkspaceFolderPath ,
35
36
GoVersion ,
36
37
rmdirRecursive ,
37
38
} from './util' ;
@@ -350,8 +351,15 @@ export function updateGoVarsFromConfig(): Promise<void> {
350
351
}
351
352
352
353
return new Promise < void > ( ( resolve , reject ) => {
353
- cp . execFile ( goRuntimePath , [ 'env' , 'GOPATH' , 'GOROOT' , 'GOPROXY' , 'GOBIN' , 'GOMODCACHE' ] , ( err , stdout , stderr ) => {
354
- if ( err ) {
354
+ cp . execFile ( goRuntimePath ,
355
+ [ 'env' , 'GOPATH' , 'GOROOT' , 'GOPROXY' , 'GOBIN' , 'GOMODCACHE' ] ,
356
+ { env : toolExecutionEnvironment ( ) , cwd : getWorkspaceFolderPath ( ) } ,
357
+ ( err , stdout , stderr ) => {
358
+ if ( err || stderr ) {
359
+ outputChannel . append ( `Failed to run '${ goRuntimePath } env: ${ err } \n${ stderr } ` ) ;
360
+ outputChannel . show ( ) ;
361
+
362
+ vscode . window . showErrorMessage ( `Failed to run '${ goRuntimePath } env. The config change may not be applied correctly.` ) ;
355
363
return reject ( ) ;
356
364
}
357
365
const envOutput = stdout . split ( '\n' ) ;
0 commit comments