-
Notifications
You must be signed in to change notification settings - Fork 764
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
debug: failed to launch with error "invalid debug configuration - cannot unmarshal ... into env
"
#2206
Comments
@ssrlive can you enable logging and see if there is any boolean type value among the @suzmue @polinasok We've seen the extension was sending non-string type env vars to the debug adapter which expects
What do you prefer? |
@ssrlive To enable the logging, you can use "showLog" and "logOutput":"dap" attributes in your
And this is what's logged:
@hyangah Yes, the extension doesn't require strings while dlv does. We likely wanted to be consistent with |
Thinking about this more. As per the OS convention, the final values for environment variables must be strings. If users read or set the values in their Go programs, they will deal with them as strings. So it is logical to expect our users to provide all string values in their json maps. Of course, one might argue that we might also want to allow scalars like ints or bools because when environment variables are set on the command line, users can omit the quotes for strings without spaces. But I am not convinced that this is worth the added complexity in either extension or delve code or documentation or error messages. I think the current message coming from delve is pretty clear and the problem is that the user doesn't realize that the unspecified So I propose that we:
|
my
|
This boolean
|
@hyangah Is it even right that we pass |
|
@ssrlive Your settings.json has syntax error.
This part
should be
|
I don't know, it generate automatically. |
The only setting the extension may automatically added is Looked through your
|
Change https://go.dev/cl/401974 mentions this issue: |
…ibutes Updates #2206 Change-Id: Ifd31119b0eafae6ea617ed5c7d405626e3720345 GitHub-Last-Rev: 4a6466c GitHub-Pull-Request: #2209 Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/401974 Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com> Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com> TryBot-Result: kokoro <noreply+kokoro@google.com> Reviewed-by: Polina Sokolova <polina@google.com>
env
"
Good point. Since now dlv can process
If debugAdapter == dlv-dap:
|
Start dlv with the env settings and let it decide how to combine that with env for debuggee? Makes sense.
I didn't know how to do this when I updated the comments because typed |
It looks no one can resolve this bug. this bug will live forever. |
Thanks to the discussion here, I was able to fix my issue with using the latest version of vscode-go. But is there a reason why the following {
"go.toolsManagement.autoUpdate": true,
"go.toolsEnvVars": {
"gopls.env": { /* This caused an error message very similar to the above one except about objects*/
"GOFLAGS": "-tags=integration unit"
},
},
"go.buildTags": "-tags=integration unit",
"diffEditor.wordWrap": "on",
"editor.wordWrap": "on",
"security.workspace.trust.untrustedFiles": "open",
"window.zoomLevel": 1
} Commenting out/removing |
|
Gotcha. It seems that this was either added a ways back by me before it rejected non-string type key value pairs or it was automatically added when I updated a setting. But now that I have removed it, it is working again. |
请问现在有解决的办法了吗? 深受其害, 印象里 好像之前是可以的, 而且我直接运行是可以的, 唯有debug的时候报这个错误 |
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
orcode-insiders -v
to get version of VS Code or VS Code Insiders.Commit: dfd34e8260c270da74b5c2d86d61aee4b6d56977
Date: 2022-04-11T07:49:20.994Z (1 wk ago)
Electron: 17.2.0
Chromium: 98.0.4758.109
Node.js: 16.13.0
V8: 9.8.177.11-electron.0
OS: Darwin x64 21.4.0
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.gotests
gomodifytags
impl
goplay
dlv
staticcheck
gopls
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
Can NOT debug. Always pop-up this dialog tell me that
Failed to launch: invalid debug configuration - cannot unmarshal bool into "env" of type string
.and
launch.json
is hereI have test the same steps on Linux and everything looks fine.
Screenshots or recordings
The text was updated successfully, but these errors were encountered: