-
Notifications
You must be signed in to change notification settings - Fork 867
Description
What version of Go, VS Code & VS Code Go extension are you using?
Version Information
-
Run
go versionto get version of Go from the VS Code integrated terminal.- go version go1.20 windows/amd64
- also experienced with go1.19 windows/amd64
-
Run
gopls -v versionto get version of Gopls from the VS Code integrated terminal.
Build info
----------
golang.org/x/tools/gopls 0.4.3
golang.org/x/tools/[email protected] h1:irz7Q+XdHNECamFKbNWKvMV2Ak6zBbwdwbZndG4545I=
github.com/BurntSushi/[email protected] h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
github.com/sergi/[email protected] h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0=
golang.org/x/[email protected] h1:KU7oHjnv3XNWfa5COkzUifxZmxp1TyI7ImMXqFxLwvQ=
golang.org/x/[email protected] h1:vcxGaoTs7kV8m5Np9uUNQin4BrLOthgV7252N8V+FwY=
golang.org/x/[email protected] h1:Vc0Vx98oU/O3+qPQ36fnTT5UduS55KLh2uSGbL7mqEo=
golang.org/x/[email protected] h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
honnef.co/go/[email protected] h1:UoveltGrhghAA7ePc+e+QYDHXrBps2PqFZiHkGR/xK8=
mvdan.cc/xurls/[email protected] h1:NSZPykBXJFCetGZykLAxaL6SIpvbVy/UFEniIfHAa8A=Go info ------- go version go1.20 windows/amd64 -
Run
code -vorcode-insiders -vto get version of VS Code or VS Code Insiders.
1.75.0
e2816fe719a4026ffa1ee0189dc89bdfdbafb164
x64 -
Check your installed extensions to get the version of the VS Code Go extension
- v0.37.1
-
Run Ctrl+Shift+P (Cmd+Shift+P on Mac OS) >
Go: Locate Configured Go Toolscommand.- Command 'Go: Locate Configured Go Tools' resulted in an error (command 'go.locate.tools' not round)
Share the Go related settings you have added/edited
"go.gopath": "$HOME/go",
"go.lintFlags": [
"--fast",
"--skip-dirs='vendor'",
"--print-resources-usage"
],
"go.useLanguageServer": true,
"go.formatTool": "gofumports",
"go.lintTool": "golangci-lint",
"go.lintOnSave": "file",
"go.autocompleteUnimportedPackages": true,
"go.testOnSave": false,
"go.buildOnSave": "off",
"go.editorContextMenuCommands": {
"toggleTestFile": true,
"addTags": true,
"removeTags": false,
"testAtCursor": true,
"testFile": false,
"testPackage": false,
"generateTestForFunction": true,
"generateTestForFile": false,
"generateTestForPackage": false,
"addImport": true,
"testCoverage": true,
"playground": false,
"debugTestAtCursor": true
},
"go.enableCodeLens": {
"references": false,
"runtest": false
},
"go.useCodeSnippetsOnFunctionSuggest": true,
"go.useCodeSnippetsOnFunctionSuggestWithoutType": false,
"go.gotoSymbol.includeImports": true,
"go.buildTags": "dev",
"go.liveErrors": {
"enabled": true,
"delay": 500
},
"[go]": {
"editor.snippetSuggestions": "none",
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.organizeImports": true
}
},
"gopls": {
"usePlaceholders": true,
},
Describe the bug
The Go extension appears to fail initializing.
I have no code completion, automatic vetting, linting or formatting.
In my Output for Go:
Failed to run 'C:\Program Files\Go\bin\go.exe env' (cwd: D:\work\spartan-dog\chase-a-lot\mocks): Error: Command failed: C:\Program Files\Go\bin\go.exe env -json GOPATH GOROOT GOPROXY GOBIN GOMODCACHE
go: GOPATH entry is relative; must be absolute path: "$HOME/go".
For more details see: 'go help gopath'
go: GOPATH entry is relative; must be absolute path: "$HOME/go".
For more details see: 'go help gopath'
The locations are correct.
I think relevantly, my default terminal is PowerShell and the above command 'C:\Program Files\Go\bin\go.exe env' would be invalid and should be prefixed with an &.
& 'C:\Program Files\Go\bin\go.exe' env -json GOPATH GOROOT GOPROXY GOBIN GOMODCACHE
Yields:
PS D:\work\spartan-dog\chase-a-lot\mocks> & 'C:\Program Files\Go\bin\go.exe' env -json GOPATH GOROOT GOPROXY GOBIN GOMODCACHE
{
"GOBIN": "",
"GOMODCACHE": "C:\\Users\\Christopher\\go\\pkg\\mod",
"GOPATH": "C:\\Users\\Christopher\\go",
"GOPROXY": "https://proxy.golang.org,direct",
"GOROOT": "C:\\Program Files\\Go"
}
I'd expect the extension to behave as it does in other environments.
It currently works exactly as I'd like inside of a WSL2 Ubuntu instance on the same machine.
Steps to reproduce the behavior:
- Start vscode with Go extension
Screenshots or recordings
N/A