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

Ensure environment variables for gocode process are not configured fo… #156

Merged
merged 1 commit into from
Dec 12, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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