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
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.
Run gopls -v version to get version of Gopls from the VS Code integrated terminal.
Run code -v or code-insiders -v to get version of VS Code or VS Code Insiders.
Check your installed extensions to get the version of the VS Code Go extension
Run Ctrl+Shift+P (Cmd+Shift+P on Mac OS) > Go: Locate Configured Go Tools command.
$ go version
go version go1.22.2 darwin/arm64
$ code -v
1.88.1
e170252f762678dec6ca2cc69aba1570769a5d39
arm64
$ gopls -v
golang.org/x/tools/gopls v0.15.3
Go extension version: v0.41.3
Located Configured Go Tools
## Tools
go: /usr/local/go/bin/go: go version go1.22.2 darwin/amd64
gopls: ~/go/bin/gopls (version: v0.15.3 built with go: go1.22.2)
gotests: ~/go/bin/gotests (version: v1.6.0 built with go: go1.22.2)
gomodifytags: ~/go/bin/gomodifytags (version: v1.16.0 built with go: go1.22.2)
impl: ~/go/bin/impl (version: v1.1.0 built with go: go1.22.2)
goplay: ~/go/bin/goplay (version: v1.0.0 built with go: go1.22.2)
dlv: ~/go/bin/dlv (version: v1.22.1 built with go: go1.22.2)
golangci-lint: ~/go/bin/golangci-lint (version: v1.57.2 built with go: go1.22.2)
## Go env
Workspace Folder (go-sandbox): ~/src/adhoc/go-sandbox
GO111MODULE=''
GOARCH='arm64'
GOBIN=''
GOCACHE='~/Library/Caches/go-build'
GOENV='~/Library/Application Support/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='arm64'
GOHOSTOS='darwin'
GOINSECURE=''
GOMODCACHE='~/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='darwin'
GOPATH='~/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/usr/local/go'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/usr/local/go/pkg/tool/darwin_arm64'
GOVCS=''
GOVERSION='go1.22.2'
GCCGO='gccgo'
AR='ar'
CC='clang'
CXX='clang++'
CGO_ENABLED='1'
GOMOD='~/src/adhoc/go-sandbox/go.mod'
GOWORK=''
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -ffile-prefix-map=/var/folders/9w/3rt1brls67l_mv2m7_r5djcc0000gn/T/go-build2558003629=/tmp/go-build -gno-record-gcc-switches -fno-common'
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.
A clear and concise description of what the bug.
A clear and concise description of what you expected to happen.
I wanted to setup dubugger with configuration docs and set environment value at launch.json.
But this is not reflected and when I set up environment values via go.testsEnvVars these are reflected.
Is the configuration docs correct?
If my sequence to reproduce is light, can I update the configuration docs below?
|`env`| Environment variables passed to the launched debuggee program. Format as string key:value pairs. Merged with `envFile` and `go.toolsEnvVars` with precedence `env` > `envFile` > `go.toolsEnvVars`.<br/> | <center>_n/a_</center> |
|`envFile`| Absolute path to a file containing environment variable definitions, formatted as string key=value pairs. Multiple files can be specified by provided an array of absolute paths. Merged with `env` and `go.toolsEnvVars` with precedence `env` > `envFile` > `go.toolsEnvVars`. <br/> | <center>_n/a_</center> |
Starting: ~/go/bin/dlv dap --listen=127.0.0.1:50448 --log-dest=3 from ~/src/adhoc/go-sandbox
DAP server listening at: 127.0.0.1:50448
Type 'dlv help'for list of commands.
ENV1:
ENV2:
Hello World
PASS
Process 92287 has exited with status 0
Detaching
Not reflected case 2: add envFile to the root dir.
Set this envFile, the same directory with go.mod.
ENV1=test1
ENV2=test2
Run dubug test, the output was below.
Starting: ~/go/bin/dlv dap --listen=127.0.0.1:50448 --log-dest=3 from ~/src/adhoc/go-sandbox
DAP server listening at: 127.0.0.1:50448
Type 'dlv help'for list of commands.
ENV1:
ENV2:
Hello World
PASS
Process 92287 has exited with status 0
Detaching
Reflected Case: set go.testsEnvVars
Set env vars at workspace setting.json (or user setting.json)
Starting: ~/go/bin/dlv dap --listen=127.0.0.1:50681 --log-dest=3 from ~/src/adhoc/go-sandbox
DAP server listening at: 127.0.0.1:50681
Type 'dlv help'for list of commands.
ENV1: test1
ENV2: test2
Hello World
PASS
Process 96791 has exited with status 0
Detaching
Screenshots or recordings
If applicable, add screenshots or recordings to help explain your problem.
The text was updated successfully, but these errors were encountered:
That is because debug test does not use launch.json. (#855)
If you trigger debugging with Start Debugging (F5), you will see the launch.json configuration being used.
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.gopls -v version
to get version of Gopls from the VS Code integrated terminal.code -v
orcode-insiders -v
to get version of VS Code or VS Code Insiders.Go: Locate Configured Go Tools
command.v0.41.3
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
A clear and concise description of what the bug.
A clear and concise description of what you expected to happen.
I wanted to setup dubugger with configuration docs and set environment value at
launch.json
.But this is not reflected and when I set up environment values via
go.testsEnvVars
these are reflected.Is the configuration docs correct?
If my sequence to reproduce is light, can I update the configuration docs below?
vscode-go/docs/debugging.md
Lines 453 to 454 in d0d95ab
Steps to reproduce the behavior:
The minimum code is below.
Not reflected case 1: set env at launch.json
Setup launch.json below.
Run
dubug test
, the output was below.Not reflected case 2: add envFile to the root dir.
Set this envFile, the same directory with go.mod.
Run
dubug test
, the output was below.Reflected Case: set
go.testsEnvVars
Set env vars at workspace setting.json (or user setting.json)
Run
dubug test
, the output was below.Screenshots or recordings
If applicable, add screenshots or recordings to help explain your problem.
The text was updated successfully, but these errors were encountered: