golang won’t run on code install under windows: access denied

  go, visual-studio-code, windows

I’m using Visual Studio Code under Windows 10, with BitDefender installed, as an administrator. When program in Go is run thru code console, it drop an error – ‘access denied’ and no matter what I’m unable to force it to run.

PS C:UsersAdministratorDesktopprogramowanie> go run "c:UsersAdministratorDesktopprogramowanieargsargsy.go"
open C:UsersAdministratorAppDataLocalTempgo-build1644240760b001exeargsy.exe: Odmowa dostępu.
go: failed to remove work dir: remove C:UsersAdministratorAppDataLocalTempgo-build1644240760b001exe: Proces nie może uzyskać dostępu do pliku, ponieważ jest on używany przez inny proces.

Words "odmowa dostępu" means "access denied". However, I do have full rights to do everything in that directory (C:….AppDataLocalTemp…).

Questions:

  1. How to force this to run directly from Visual Studio Code?
    1a. How to change VSCode configuration to allow me to run golang programs in other dir (like for example C:UsersMeDesktop or so).
  2. How to force golang to work with BitDefender without disabling it?

Note: I have also an extension installed: Go, from Go Team at Google.

Here is my go env output:

PS C:UsersAdministratorDesktopprogramowanie> go env
set GO111MODULE=
set GOARCH=amd64
set GOBIN=
set GOCACHE=C:UsersAdministratorAppDataLocalgo-build
set GOENV=C:UsersAdministratorAppDataRoaminggoenv
set GOEXE=.exe
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOINSECURE=
set GOMODCACHE=C:UsersAdministratorgopkgmod
set GONOPROXY=
set GONOSUMDB=
set GOOS=windows
set GOPATH=C:UsersAdministratorgo
set GOPRIVATE=
set GOPROXY=https://proxy.golang.org,direct
set GOROOT=C:Program FilesGo
set GOSUMDB=sum.golang.org
set GOTMPDIR=
set GOTOOLDIR=C:Program FilesGopkgtoolwindows_amd64
set GOVCS=
set GOVERSION=go1.16.2
set GCCGO=gccgo
set AR=ar
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set GOMOD=NUL
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 -fmessage-length=0 -fdebug-prefix-map=C:UsersAdministratorAppDataLocalTempgo-build587150937=/tmp/go-build -gno-record-gcc-switches

Source: Windows Questions

LEAVE A COMMENT