I am trying to pass argument to delve through VS Code but it doesn't work.
This is how to pass argument to a go program through delve:
dlv debug github.com/docker/swarm -- create
I tried many different solution in my launch.json
:
"args": [
"--",
"create"
]
"args": [
"--create"
]
"args": [
"create"
]
To set command-line arguments in Visual Studio, right click on the project name, then go to Properties. In the Properties Pane, go to "Debugging", and in this pane is a line for "Command-line arguments." Add the values you would like to use on this line. They will be passed to the program via the argv array.
Expressions can be evaluated with the Debug Console REPL (Read-Eval-Print Loop) feature. To open the Debug Console, use the Debug Console action at the top of the Debug pane or use the View: Debug Console command (Ctrl+Shift+Y).
In Visual Studio Code, use shortcut Ctrl + Shift + P to open the Command Palette and type Open launch. json . And it will open the launch. json file for you.
A launch. json file is used to configure the debugger in Visual Studio Code. Visual Studio Code generates a launch. json (under a . vscode folder in your project) with almost all of the required information.
After many attempts, I found the right one:
"args": [
"--create",
"true"
]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With