profile
viewpoint

Ask questionsFailed to run go.exe: Error: spawn go.exe ENOENT, but the file does exist

What version of Go, VS Code & VS Code Go extension are you using?

  • Run go version to get version of Go
    • go version go1.15.2 windows/amd64
  • Run code -v or code-insiders -v to get version of VS Code or VS Code Insiders
1.50.0
93c2f0fbf16c5a4b10e4d5f89737d9c2c25488a3
x64
  • Check your installed extensions to get the version of the VS Code Go extension
    • 0.17.2
  • Run go env to get the go development environment details
set GO111MODULE=
set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\gleep\AppData\Local\go-build
set GOENV=C:\Users\gleep\AppData\Roaming\go\env
set GOEXE=.exe
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOINSECURE=
set GOMODCACHE=C:\Users\gleep\Desktop\Coding\go\pkg\mod
set GONOPROXY=
set GONOSUMDB=
set GOOS=windows
set GOPATH=C:\Users\gleep\Desktop\Coding\go
set GOPRIVATE=
set GOPROXY=https://proxy.golang.org,direct
set GOROOT=c:\go
set GOSUMDB=sum.golang.org
set GOTMPDIR=
set GOTOOLDIR=c:\go\pkg\tool\windows_amd64
set GCCGO=gccgo
set AR=ar
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set GOMOD=C:\Users\gleep\Desktop\Coding\go\src\clis\go.mod
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -mthreads -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=C:\Users\gleep\AppData\Local\Temp\go-build398277210=/tmp/go-build -gno-record-gcc-switches

Share the Go related settings you have added/edited

Run Preferences: Open Settings (JSON) command to open your settings.json file. Share all the settings with the go. or ["go"] or gopls prefixes.

Describe the bug

When starting up VS Code, I get the following errors in the "Output" tab:

Failed to run 'C:\Go\bin\go.exe env: Error: spawn C:\Go\bin\go.exe ENOENT
failed to run "C:\Go\bin\go.exe version": Error: spawn C:\Go\bin\go.exe ENOENT

I also get a vs code notification with the message:

Failed to run 'C:\Go\bin\go.exe env. The config change may not be applied correctly

Because of these errors (I'm assuming), the Go extension isn't working--no linting, completion suggestions, etc.

The path in question (C:\Go\bin\go.exe) also exists (see attached image), so I'm not quite sure what's causing the issue.

Steps to reproduce the behavior:

  1. Start VS Code
  2. See error

Screenshots or recordings

File exists image

golang/vscode-go

Answer questions hyangah

@leep-frog Are you running any antivirus programs that would prevent vscode/node.js program from running executables? What happens if you run the command C:\Go\bin\go.exe version or C:\Go\bin\go.exe env from the integrated terminal of vscode?

useful!
source:https://uonfu.com/
Github User Rank List