Description
What version of Go, VS Code & VS Code Go extension are you using?
Version Information
- Run
go version
to get version of Go from the VS Code integrated terminal.- go version go1.21.6 windows/amd64
- Run
gopls -v version
to get version of Gopls from the VS Code integrated terminal.- golang.org/x/tools/gopls v0.14.2
- Run
code -v
orcode-insiders -v
to get version of VS Code or VS Code Insiders.- 1.85.1 (0ee08df0cf4527e40edc9aa28f4b5bd38bbff2b2 x64)
- Check your installed extensions to get the version of the VS Code Go extension
- 0.40.1
- Run Ctrl+Shift+P (Cmd+Shift+P on Mac OS) >
Go: Locate Configured Go Tools
command.
Share the Go related settings you have added/edited
Checking configured tools....
GOBIN: undefined
toolsGopath:
gopath: C:\Users\tommy\go
GOROOT: C:\Program Files\Go
PATH: C:\Users\tommy\go\bin;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Program Files\protoc-24.0-rc-3-win64\bin;C:\Program Files (x86)\Razer Chroma SDK\bin;C:\Program Files\Razer Chroma SDK\bin;C:\Program Files (x86)\Razer\ChromaBroadcast\bin;C:\Program Files\Razer\ChromaBroadcast\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\dotnet\;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;C:\Program Files\Go\bin;C:\Program Files (x86)\Microsoft SQL Server\90\Tools\binn\;C:\Program Files\Docker\Docker\resources\bin;C:\Program Files\Java\jdk-11.0.8\bin;C:\Program Files (x86)\GNU Arm Embedded Toolchain\10 2020-q4-major\bin;C:\Users\tommy\AppData\Local\Microsoft\WindowsApps;C:\Program Files\JetBrains\IntelliJ IDEA 2019.3.1\bin;C:\WINDOWS\system32;C:\Program Files;C:\Users\tommy\AppData\Local\Programs\Hyper\resources\bin;C:\Users\tommy\AppData\Roaming\npm;C:\Program Files\Git\bin;%PyCharm Edu%;C:\Program Files (x86)\Nmap;C:\Users\tommy\AppData\Local\Microsoft\WindowsApps;C:\Users\tommy\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\tommy\go\bin
go: C:\Program Files\Go\bin\go.exe: go version go1.21.5 windows/amd64
gopls: C:\Users\tommy\go\bin\gopls.exe (version: v0.14.2 built with go: go1.21.0)
gotests: C:\Users\tommy\go\bin\gotests.exe (version: v1.6.0 built with go: go1.21.0)
gomodifytags: C:\Users\tommy\go\bin\gomodifytags.exe (version: v1.16.0 built with go: go1.21.0)
impl: C:\Users\tommy\go\bin\impl.exe (version: v1.1.0 built with go: go1.21.0)
goplay: C:\Users\tommy\go\bin\goplay.exe (version: v1.0.0 built with go: go1.21.0)
dlv: C:\Users\tommy\go\bin\dlv.exe (version: v1.21.0 built with go: go1.21.0)
staticcheck: C:\Users\tommy\go\bin\staticcheck.exe (version: v0.4.3 built with go: go1.21.0)
go env
Workspace Folder (.vscode): c:\Users\tommy\Desktop\anra\repo\anra-aware-routing\.vscode
set GO111MODULE=
set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\tommy\AppData\Local\go-build
set GOENV=C:\Users\tommy\AppData\Roaming\go\env
set GOEXE=.exe
set GOEXPERIMENT=
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOINSECURE=
set GOMODCACHE=C:\Users\tommy\go\pkg\mod
set GONOPROXY=bitbucket.org/anra-contract-support/*
set GONOSUMDB=bitbucket.org/anra-contract-support/*
set GOOS=windows
set GOPATH=C:\Users\tommy\go
set GOPRIVATE=bitbucket.org/anra-contract-support/*
set GOPROXY=https://proxy.golang.org,direct
set GOROOT=C:\Program Files\Go
set GOSUMDB=sum.golang.org
set GOTMPDIR=
set GOTOOLCHAIN=auto
set GOTOOLDIR=C:\Program Files\Go\pkg\tool\windows_amd64
set GOVCS=
set GOVERSION=go1.21.5
set GCCGO=gccgo
set GOAMD64=v1
set AR=ar
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set GOMOD=NUL
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 -mthreads -fno-caret-diagnostics -Qunused-arguments -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=C:\Users\tommy\AppData\Local\Temp\go-build4015930106=/tmp/go-build -gno-record-gcc-switches
Workspace Folder (anra-aware-routing): c:\Users\tommy\Desktop\anra\repo\anra-aware-routing
set GO111MODULE=
set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\tommy\AppData\Local\go-build
set GOENV=C:\Users\tommy\AppData\Roaming\go\env
set GOEXE=.exe
set GOEXPERIMENT=
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOINSECURE=
set GOMODCACHE=C:\Users\tommy\go\pkg\mod
set GONOPROXY=bitbucket.org/anra-contract-support/*
set GONOSUMDB=bitbucket.org/anra-contract-support/*
set GOOS=windows
set GOPATH=C:\Users\tommy\go
set GOPRIVATE=bitbucket.org/anra-contract-support/*
set GOPROXY=https://proxy.golang.org,direct
set GOROOT=C:\Program Files\Go
set GOSUMDB=sum.golang.org
set GOTMPDIR=
set GOTOOLCHAIN=auto
set GOTOOLDIR=C:\Program Files\Go\pkg\tool\windows_amd64
set GOVCS=
set GOVERSION=go1.21.5
set GCCGO=gccgo
set GOAMD64=v1
set AR=ar
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set GOMOD=NUL
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 -mthreads -fno-caret-diagnostics -Qunused-arguments -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=C:\Users\tommy\AppData\Local\Temp\go-build1918825366=/tmp/go-build -gno-record-gcc-switches
Workspace Folder (anra-aware-routing-gateway): c:\Users\tommy\Desktop\anra\repo\anra-aware-routing\anra-aware-routing-gateway
set GO111MODULE=
set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\tommy\AppData\Local\go-build
set GOENV=C:\Users\tommy\AppData\Roaming\go\env
set GOEXE=.exe
set GOEXPERIMENT=
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOINSECURE=
set GOMODCACHE=C:\Users\tommy\go\pkg\mod
set GONOPROXY=bitbucket.org/anra-contract-support/*
set GONOSUMDB=bitbucket.org/anra-contract-support/*
set GOOS=windows
set GOPATH=C:\Users\tommy\go
set GOPRIVATE=bitbucket.org/anra-contract-support/*
set GOPROXY=https://proxy.golang.org,direct
set GOROOT=C:\Program Files\Go
set GOSUMDB=sum.golang.org
set GOTMPDIR=
set GOTOOLCHAIN=auto
set GOTOOLDIR=C:\Program Files\Go\pkg\tool\windows_amd64
set GOVCS=
set GOVERSION=go1.21.5
set GCCGO=gccgo
set GOAMD64=v1
set AR=ar
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set GOMOD=c:\Users\tommy\Desktop\anra\repo\anra-aware-routing\anra-aware-routing-gateway\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 -mthreads -fno-caret-diagnostics -Qunused-arguments -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=C:\Users\tommy\AppData\Local\Temp\go-build1220691165=/tmp/go-build -gno-record-gcc-switches
Workspace Folder (anra-aware-routing-service): c:\Users\tommy\Desktop\anra\repo\anra-aware-routing\anra-aware-routing-service
set GO111MODULE=
set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\tommy\AppData\Local\go-build
set GOENV=C:\Users\tommy\AppData\Roaming\go\env
set GOEXE=.exe
set GOEXPERIMENT=
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOINSECURE=
set GOMODCACHE=C:\Users\tommy\go\pkg\mod
set GONOPROXY=bitbucket.org/anra-contract-support/*
set GONOSUMDB=bitbucket.org/anra-contract-support/*
set GOOS=windows
set GOPATH=C:\Users\tommy\go
set GOPRIVATE=bitbucket.org/anra-contract-support/*
set GOPROXY=https://proxy.golang.org,direct
set GOROOT=C:\Program Files\Go
set GOSUMDB=sum.golang.org
set GOTMPDIR=
set GOTOOLCHAIN=auto
set GOTOOLDIR=C:\Program Files\Go\pkg\tool\windows_amd64
set GOVCS=
set GOVERSION=go1.21.5
set GCCGO=gccgo
set GOAMD64=v1
set AR=ar
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set GOMOD=c:\Users\tommy\Desktop\anra\repo\anra-aware-routing\anra-aware-routing-service\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 -mthreads -fno-caret-diagnostics -Qunused-arguments -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=C:\Users\tommy\AppData\Local\Temp\go-build328245091=/tmp/go-build -gno-record-gcc-switches
Run Preferences: Open Settings (JSON)
command to open your settings.json file.
Share all the settings with the go.
or ["go"]
or gopls
prefixes.
"go.toolsManagement.autoUpdate": true,
"go.autocompleteUnimportedPackages": true,
Describe the bug
- A clear and concise description of what the bug.
I have configured VS Code to use the MinGW64 terminal from MSYS2 as my integrated terminal for Go development. This configuration includes setting specific environment variables to ensure that the terminal uses the MinGW64 environment. My settings.json includes the following relevant settings:
"terminal.integrated.profiles.windows": {
"mingw64": {
"path": "C:\\msys64\\usr\\bin\\bash.exe",
"args": ["--login", "-i"],
"env": {
"MSYSTEM": "MINGW64",
"CHERE_INVOKING": "1",
"MSYS2_PATH_TYPE": "inherit"
},
"overrideName": true
},
// "mingw64": {
// "path": "C:/msys64/msys2_shell.cmd",
// "args": [
// "-defterm",
// "-here",
// "-no-start",
// "-mingw64"
// ]
// }
},
"terminal.integrated.defaultProfile.windows": "mingw64",
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Launch Package",
"type": "go",
"request": "launch",
"mode": "auto",
"program": "${workspaceFolder}/cmd",
"console": "integratedTerminal",
}
]
}
However, when I start a debug session using the integrated terminal, it defaults to the MSYS environment instead of MinGW64. This behavior suggests that the debug session might not be inheriting or respecting the environment variables set for the MinGW64 terminal profile. Specifically, it seems to ignore the "MSYSTEM": "MINGW64" setting, which is crucial for my development environment.
This issue causes significant problems in my build and debug process, as my project requires the MinGW64 environment for proper compilation and execution, especially when dealing with cgo dependencies.
- A clear and concise description of what you expected to happen.
I expect the debug session to start in the MinGW64 environment, inheriting the integrated terminal's configuration, including the environment variables set in settings.json. This should ensure compatibility with my project's build requirements and allow for a seamless debugging experience.
Steps to reproduce the behavior:
Configure VS Code to use MSYS2's MinGW64 as the integrated terminal.
Set up a Go project that requires MinGW64 (e.g., a project using cgo with MinGW64 dependencies).
Start a debug session in VS Code.
The terminal defaults to MSYS instead of MinGW64.