What I did:
Create file main.go (in a directory named example) containing:
package main
import (
"fmt"
"os"
)
func main() {
fmt.Println(os.Args)
}
Run commands:
$ go build
$ dlv ./example bar
Type 'help' for list of commands.
(dlv) continue
[./example]
Stopped at: 0x0
=> no source available
(dlv) Would you like to kill the process? [y/n]
[Hope I was of service hunting your bug!]
What I expected:
...
(dlv) continue
[./example bar]
...
Versions:
$ dlv -v
flag provided but not defined: -v
Delve version 0.5.0.beta
flags:
-addr=localhost:0: Debugging server listen address.
-log=false: Enable debugging server logging.
-version=false: Print version number and exit.
Invoke with the path to a binary:
dlv ./path/to/prog
or use the following commands:
run - Build, run, and attach to program
test - Build test binary, run and attach to it
attach - Attach to running process
$ go version
go version go1.4.2 darwin/amd64
$ uname -a
Darwin silver.sethwklein.net 14.3.0 Darwin Kernel Version 14.3.0: Mon Mar 23 11:59:05 PDT 2015; root:xnu-2782.20.48~5/RELEASE_X86_64 x86_64
@sethwklein can you try against the latest version? This issue should be resolved.
Works for me. Thanks!
How Can I do that setting command line arguments?
I use :Delve version: 0.10.0-alpha
@luweijie007 a comment on a closed and possibly unrelated bug report may not be an effective place to get help. Can you try asking in https://gitter.im/derekparker/delve ?
ok , I go to gitter. thanks your reply
@luweijie007 AFAICT passing arguments on the command line still works ok.
If you have a precompiled binary:
$ dlv exec ./executable argument1 argument2…
if you want delve to compile the program for you (like go build would):
$ dlv debug argument1 argument2…
argument1, argument2, &c. will be passed to the target.
This still does not work if the compiled binary has args of the form --
e.g
dlv exec ./hello server --config conf/config.toml
Usage:
dlv exec [./path/to/binary] [flags]
Global Flags:
--build-flags="": Build flags, to be passed to the compiler.
--headless[=false]: Run debug server only, in headless mode.
--init="": Init file, executed by the terminal client.
-l, --listen="localhost:0": Debugging server listen address.
--log[=false]: Enable debugging server logging.
Error: unknown flag: --config
@keshavab arguments are different than flags. For flags, please ensure you use this form:
dlv exec ./hello -- server --config conf/config.toml
Thanks @derekparker. That helped.
It's not documented or may be i did not find it. I can send a PR if its not there.
I could not find documentation on this feature as well. I created a PR to add to docs: https://github.com/derekparker/delve/pull/733
Most helpful comment
@keshavab arguments are different than flags. For flags, please ensure you use this form: