VS code extension error trying to write to C:\WINDOWS
xiegeo opened this issue · 5 comments
Using the vs code extension on window produced the following error. Looks like it's trying to build code in the windows system directory, which it obviously should not.
log output
gopium 🌺: C:\Users\...\go\bin\gopium.exe -p c:\Users\...\seed\dictionary -r ^Dictionary$ -c gc -a amd64 -l 64 -l 64 -l 64 -d -b -i 0 -w 8 -t 0 ast_go dictionary memory_pack
Error: visiting error happened err: exit status 1: stderr: go: creating work dir: mkdir C:\WINDOWS\go-build1514569921: Access is denied.
$ gopium -v
gopium version 1.6.2
$ go version
go version go1.19.3 windows/amd64
vs-code version:
Version: 1.73.1 (user setup)
Commit: 6261075646f055b99068d3688932416f2346dd3b
Date: 2022-11-09T04:27:29.066Z
Electron: 19.0.17
Chromium: 102.0.5005.167
Node.js: 16.14.2
V8: 10.2.154.15-electron.0
OS: Windows_NT x64 10.0.22621
Sandboxed: No
$ go env
set GO111MODULE=on
set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\xiege\AppData\Local\go-build
set GOENV=C:\Users\xiege\AppData\Roaming\go\env
set GOEXE=.exe
set GOEXPERIMENT=
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOINSECURE=
set GOMODCACHE=C:\Users\xiege\go\pkg\mod
set GONOPROXY=...
set GONOSUMDB=...
set GOOS=windows
set GOPATH=C:\Users\xiege\go
set GOPRIVATE=...
set GOPROXY=https://goproxy.cn,https://mirrors.aliyun.com/goproxy/,direct
set GOROOT=C:\Program Files\Go
set GOSUMDB=sum.golang.org
set GOTMPDIR=
set GOTOOLDIR=C:\Program Files\Go\pkg\tool\windows_amd64
set GOVCS=
set GOVERSION=go1.19.3
set GCCGO=gccgo
set GOAMD64=v1
set AR=ar
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set GOMOD=C:\Users\...\seed\go.mod
set GOWORK=
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 -Wl,--no-gc-sections -fmessage-length=0 -fdebug-prefix-map=C:\Users\xiege\AppData\Local\Temp\go-build3538426132=/tmp/go-build -gno-record-gcc-switches
@xiegeo it actually is expected behavior, that it tries implicitly to build the package. Here underneath
Line 61 in 406af8b
C:\WINDOWS\go-build*
as its build folder.@xiegeo please try to add -e "GOCACHE=C:\Users\xiege\AppData\Local\go-build"
to the cli parameters. So your full command will look like
C:\Users\...\go\bin\gopium.exe -p c:\Users\...\seed\dictionary -r ^Dictionary$ -c gc -a amd64 -l 64 -l 64 -l 64 -d -b -i 0 -w 8 -t 0 ast_go dictionary memory_pack -e "GOCACHE=C:\Users\xiege\AppData\Local\go-build"
I got it to work with this: -e "GOCACHE=C:\Users\xiege\AppData\Local\go-build,GOPATH=C:\Users\xiege\go,GOTMPDIR=C:\tmp"
@xiegeo, In the past I added this workaround 9708581 which clearly is not universal enough. This time I made a better fix in #32 to propagate env defaults directly from go env
command. This should resolve this issue in general case, I believe. I merged it, and published as https://github.com/1pkg/gopium/releases/tag/v1.7.0. Please try it out.
Thanks, that fixed it.