golang / vscode-go

Go extension for Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=golang.Go
Other
3.79k stars 728 forks source link

Error: spawn Unknown system error -86 in Vscode using the go extension on Apple Silicon MacBook Pro #3256

Closed 4rc0s closed 2 months ago

4rc0s commented 3 months ago

After upgrading to an Apple Silicon MacBook Pro and migrating using Migration Assistant, I've been working through various issue getting Homebrew converted to ARM from Intel binaries.

One problem I'm experiencing is editing Go programs in VSCode. It's constantly showing the error message Error: Error: spawn Unknown system error -86.

I've un-installed and re-installed the Go extension with no improvement. I can compile and run go programs from the terminal. I tried setting some env variables in settings.json with no luck. E.g.,

    "go.goroot": "/opt/homebrew/Cellar/go/1.22.1/libexec",
    "go.toolsEnvVars": {
        "GOPATH": "/Users/my_username/go"
    },

I was able to get this output from Extension Host:

2024-03-15 12:12:48.989 [info] ExtensionService#_doActivateExtension golang.go, startup: false, activationEvent: 'onLanguage:go'
2024-03-15 12:19:18.256 [error] TypeError: a.getTime is not a function
    at msBetween (/Users/my_username/.vscode-insiders/extensions/golang.go-0.41.2/dist/goMain.js:29032:21)
    at daysBetween (/Users/my_username/.vscode-insiders/extensions/golang.go-0.41.2/dist/goMain.js:29026:10)
    at TelemetryService.promptForTelemetry (/Users/my_username/.vscode-insiders/extensions/golang.go-0.41.2/dist/goMain.js:30472:9)
    at Timeout.callback [as _onTimeout] (/Users/my_username/.vscode-insiders/extensions/golang.go-0.41.2/dist/goMain.js:30335:58)
    at listOnTimeout (node:internal/timers:569:17)
    at processTimers (node:internal/timers:512:7)

Any ideas on what to try next?

findleyr commented 3 months ago

CC @hyangah -- I'm a bit out of my depth here. In particular, the a.getTime is not a function error from the extension host is strange` and unexpected.

Out of curiosity, can you run gopls version from the command line? Do you get valid output? (is gopls even installed?)

hyangah commented 3 months ago

@4rc0s I don't know what "Migration Assistant" does when migrating from Intel to Arm and how smart it is in terms of converting various application-specific data.

For the "a.getTime" error messages, try "Go: Reset Global State", select all fields, etc. I don't know how VS Code encodes its key-value store, but it looks like it's corrupted.

And have you reinstalled VSCode - for Apple Silicon, too? Based on my experience, I found Mac's rosetta is too magical. It runs a binary built for Intel on Mac but eventually causes failures in more mysterious forms. Clean installation of VSCode for matching architectures reduces the errors.

gopherbot commented 2 months ago

Timed out in state WaitingForInfo. Closing.

(I am just a bot, though. Please speak up if this is a mistake or you have the requested information.)