src/goPackages.ts: pass GOROOT to gopkgs

gopkgs uses build.Default.GOROOT
so `GOROOT` env var should be set to use `gopkgs` compiled with
a different version of Go.

Updates golang/vscode-go#294

Change-Id: I746baed9fcf692a6c9248cdfd17f8ca3fef19426
Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/254137
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
diff --git a/src/goPackages.ts b/src/goPackages.ts
index c5ffd8e..b6fc42f 100644
--- a/src/goPackages.ts
+++ b/src/goPackages.ts
@@ -46,7 +46,9 @@
 			args.push('-workDir', workDir);
 		}
 
-		const cmd = cp.spawn(gopkgsBinPath, args, { env: toolExecutionEnvironment() });
+		const env = toolExecutionEnvironment();
+		env['GOROOT'] = getCurrentGoRoot();  // https://github.com/golang/vscode-go/issues/294
+		const cmd = cp.spawn(gopkgsBinPath, args, { env, cwd: workDir });
 		const chunks: any[] = [];
 		const errchunks: any[] = [];
 		let err: any;