1

Maybe I'm barking up the wrong tree, but it seems the go's delve debugger expects to get a json field "arguments" in the "launch" dap message, and it uses the "dlvFlags" ... instead of/ignoring the "dlvFlags" in its configuration. If I specify "dlvFlags" in launch.json alongside the "env" and "args", delve does seem to receive those but issues the warning "Warning: build flags ignored with dap; specify via launch/attach request instead" ... looking into the delve source code it seems to expect these via the incoming dap protocol's launch command json containing an "arguments" member.

I'm asking here because this seems like possibly a generic vscode issue, since the DAP protocol is standard?

I'm trying to pass dlvFlags to the remote dap go delve instance. Ultimately the point of this is so that the debugged program is built with --buildFlags -mod=mod

user18911088
  • 119
  • 5
  • This being specifically about how to use VS Code, which I don't use, I don't know for sure what you're trying to do, but it reminds me a bit of [this question](https://stackoverflow.com/questions/73647814/run-and-debug-unit-tests-with-flags/73734979#73734979), where my answer seemed to help – Elias Van Ootegem Aug 11 '23 at 10:50

1 Answers1

1

Looks like the key doc for this issue is here: https://github.com/golang/vscode-go/wiki/debugging#launchjson-attributes

You can correctly pass build-flags to delve by specifying buildFlags in launch.json.

Some relevant issues are: https://github.com/golang/vscode-go/issues/2932 https://github.com/go-delve/delve/issues/3462

user18911088
  • 119
  • 5