You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Check your installed extensions to get the version of the VS Code Go extension
v0.42.0
Run Ctrl+Shift+P (Cmd+Shift+P on Mac OS) > Go: Locate Configured Go Tools command.
# Tools Configuration
## Environment
GOBIN: undefined
toolsGopath:
gopath: C:\Users\JohnstonJ\Documents\Projects\dv-toolbox\.tools\gopath
GOROOT: C:\Users\JohnstonJ\Documents\Projects\dv-toolbox\.tools\goroot
PATH: C:\Users\JohnstonJ\Documents\Projects\dv-toolbox\.tools\goroot\bin;C:\Program Files\PowerShell\7;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files\Git\cmd;C:\Program Files\dotnet\;C:\Program Files\PowerShell\7\;C:\Program Files\Docker\Docker\resources\bin;C:\Users\JohnstonJ\AppData\Local\Programs\Python\Launcher\;C:\Users\JohnstonJ\AppData\Local\Microsoft\WindowsApps
PATH (vscode launched with): C:\Program Files\PowerShell\7;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files\Git\cmd;C:\Program Files\dotnet\;C:\Program Files\PowerShell\7\;C:\Program Files\Docker\Docker\resources\bin;C:\Users\JohnstonJ\AppData\Local\Programs\Python\Launcher\;C:\Users\JohnstonJ\AppData\Local\Microsoft\WindowsApps
## Tools
go: C:\Users\JohnstonJ\Documents\Projects\dv-toolbox\.tools\goroot\bin\go.exe: go version go1.23.0 windows/amd64
gopls: C:\Users\JohnstonJ\Documents\Projects\dv-toolbox\.tools\gopath\bin\gopls.exe (version: v0.16.1 built with go: go1.23.0)
gotests: not installed
gomodifytags: not installed
impl: not installed
goplay: not installed
dlv: not installed
staticcheck: C:\Users\JohnstonJ\Documents\Projects\dv-toolbox\.tools\gopath\bin\staticcheck.exe (version: v0.5.1 built with go: go1.23.0)
## Go env
Workspace Folder (dv-toolbox): c:\Users\JohnstonJ\Documents\Projects\dv-toolbox
set GO111MODULE=
set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\JohnstonJ\AppData\Local\go-build
set GOENV=C:\Users\JohnstonJ\AppData\Roaming\go\env
set GOEXE=.exe
set GOEXPERIMENT=
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOINSECURE=
set GOMODCACHE=C:\Users\JohnstonJ\Documents\Projects\dv-toolbox\.tools\gopath\pkg\mod
set GONOPROXY=
set GONOSUMDB=
set GOOS=windows
set GOPATH=C:\Users\JohnstonJ\Documents\Projects\dv-toolbox\.tools\gopath
set GOPRIVATE=
set GOPROXY=https://proxy.golang.org,direct
set GOROOT=C:\Users\JohnstonJ\Documents\Projects\dv-toolbox\.tools\goroot
set GOSUMDB=sum.golang.org
set GOTMPDIR=
set GOTOOLCHAIN=auto
set GOTOOLDIR=C:\Users\JohnstonJ\Documents\Projects\dv-toolbox\.tools\goroot\pkg\tool\windows_amd64
set GOVCS=
set GOVERSION=go1.23.0
set GODEBUG=
set GOTELEMETRY=local
set GOTELEMETRYDIR=C:\Users\JohnstonJ\AppData\Roaming\go\telemetry
set GCCGO=gccgo
set GOAMD64=v1
set AR=ar
set CC=gcc
set CXX=g++
set CGO_ENABLED=0
set GOMOD=c:\Users\JohnstonJ\Documents\Projects\dv-toolbox\go.mod
set GOWORK=
set CGO_CFLAGS=-O2 -g
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-O2 -g
set CGO_FFLAGS=-O2 -g
set CGO_LDFLAGS=-O2 -g
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -fno-caret-diagnostics -Qunused-arguments -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=C:\Users\JOHNST~1\AppData\Local\Temp\go-build2632435785=/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.
I am using Go in a portable fashion - I've downloaded Go and put it into a subdirectory of my repo, along with creating a special GOPATH.
Unfortunately, terminals created in VS Code don't have the GOPATH environment variable properly set. They do have the PATH variable updated with the new $GOROOT\bin. But not the GOPATH.
My expectation is that the terminals should have the custom GOPATH as well.
Steps to reproduce the behavior:
Set up a custom GOPATH by changing the go.gopath setting.
Open a new terminal in VS Code: I am testing with both Command Prompt and PowerShell.
Print the value of GOPATH, and observe the environment variable has not been set.
Also observe that go envwhen run from inside the terminal will print the wrong GOPATH value.
Likely root cause
There is a function called updateIntegratedTerminal at
I think it's a reasonable request. On the other hand, there are many other GO* environment variables.
(for example, GOMODCACHE, GOPRIVATE, .. are some of the commonly modified Go environment variables.)
Should these be also applied to the terminals?
@TLCFEM I think that is a separate issue. This issue is about GOPATH, not the Path/PATH handling. For your issue, can you please open a separate issue to follow up?
I think it's a reasonable request. On the other hand, there are many other GO* environment variables. (for example, GOMODCACHE, GOPRIVATE, .. are some of the commonly modified Go environment variables.) Should these be also applied to the terminals?
It seems to me like any environment variable that is controlled by the extension's configuration might be worthy of consideration to set in the terminal.
What version of Go, VS Code & VS Code Go extension are you using?
Version Information
go version
to get version of Go from the VS Code integrated terminal.go version go1.23.0 windows/amd64
gopls -v version
to get version of Gopls from the VS Code integrated terminal.golang.org/x/tools/gopls v0.16.1
code -v
orcode-insiders -v
to get version of VS Code or VS Code Insiders.v0.42.0
Go: Locate Configured Go Tools
command.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"]
orgopls
prefixes.Describe the bug
I am using Go in a portable fashion - I've downloaded Go and put it into a subdirectory of my repo, along with creating a special GOPATH.
Unfortunately, terminals created in VS Code don't have the GOPATH environment variable properly set. They do have the PATH variable updated with the new $GOROOT\bin. But not the GOPATH.
My expectation is that the terminals should have the custom GOPATH as well.
Steps to reproduce the behavior:
go.gopath
setting.go env
when run from inside the terminal will print the wrong GOPATH value.Likely root cause
There is a function called
updateIntegratedTerminal
atvscode-go/extension/src/goEnvironmentStatus.ts
Lines 371 to 400 in 7252597
It updates the PATH for the current GOROOT. But there doesn't appear to be any code for updating GOPATH. Perhaps it was simply never implemented?
Screenshots or recordings
The text was updated successfully, but these errors were encountered: