Skip to content
This repository has been archived by the owner on Jul 15, 2023. It is now read-only.

Commit

Permalink
Ensure environment variables for gocode process are not configured fo…
Browse files Browse the repository at this point in the history
…r cross compilation
  • Loading branch information
Sam Herrmann committed Dec 12, 2015
1 parent ec06892 commit f73f41d
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/goSuggest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,15 @@ export class GoCompletionItemProvider implements vscode.CompletionItemProvider {
var gocode = getBinPath("gocode");

// Spawn `gocode` process
var p = cp.execFile(gocode, ["-f=json", "autocomplete", filename, "c" + offset], {}, (err, stdout, stderr) => {
var p = cp.execFile(gocode, ["-f=json", "autocomplete", filename, "c" + offset], {
env: {
// Unset GOOS and GOARCH for the `gocode` process to ensure that GOHOSTOS and GOHOSTARCH
// are used as the target operating system and architecture. `gocode` is unable to provide
// autocompletion when the Go environment is configured for cross compilation.
GOOS: "",
GOARCH: ""
}
}, (err, stdout, stderr) => {
try {
if (err && (<any>err).code == "ENOENT") {
vscode.window.showInformationMessage("The 'gocode' command is not available. Use 'go get -u github.com/nsf/gocode' to install.");
Expand Down

0 comments on commit f73f41d

Please sign in to comment.