-
Notifications
You must be signed in to change notification settings - Fork 757
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: noDebug
build does not pass buildFlags
correctly
#1027
Comments
Thank you so much for filing this, I asked in the Slack because I wanted to rule out misconfiguration on my part. Multiple columns = multiple versions tested
Live ReproductionWith single quotes:
With escaped double-quotes:
|
I am afraid the extension has to parse the buildFlags and avoid passing quotes. The go command silently ignores the flag if quoted (so invalid) value is passed. golang/go#43177 |
Without ldflags I cannot use vscode-go to debug/run my application. Guess it's back to gdb for me for a while. Will definitely be following #860 for more information. |
@AlbinoGeek Let me clarify - this is a bug affecting only when using 'Run without Debug' (Ctrl+F5). You can still specify |
The issue boils down to:
|
(The first one in your example) This form should work with F5. If not, that's a different issue. If the quotes around At least, with @suzmue FYI here is how delve is processing |
@hyangah Unfortunately, as I described in my previous reply, it does not work with or without See the Live Reproduction section of this comment: #1027 (comment) |
@AlbinoGeek That looks like a different issue (sorry I couldn't build your example). Either provide a minimal repro case or, add the following in your launch.json to capture the log and share with us. Thanks!
|
Closing in favor of #1111 |
From the code, I see the
buildFlags
are passed when runninggo build
vscode-go/src/debugAdapter/goDebug.ts
Lines 496 to 498 in 0dee1a8
However, this flag seems to be lost somewhere. I am not sure who's stripping off this. (node.js? go? something in between?)
How to reproduce:
launch.json
With
F5
(run by delve) the program will print 'Hello' as expected.With
Ctrl+F5
(built withgo build
and then run) the program will print 'Bye'.If I use
"buildFlags": "-ldflags=-X main.V=Hello"
,Ctrl+F5
works as expected, but that breaksF5
and prevents passing additional flags. (Q. Why is the launch arg's buildFlags isstring
, notstring[]
???)Maybe related - see the following: if I pass quoted
"-ldflags=\"-X main.V=Hello\"
, this flag is lost somewhere and not used ingo
link step at all. Maybe this could be a mistake on my side, but silently dropping the flag is pretty annoying.cc @suzmue
The text was updated successfully, but these errors were encountered: