Search code examples
godelve

Using delve with subcommand and flags?


I would like to debug a subcommand (I'm using cobra) but I'm not sure how to test with delve when subcommands and flags are involved.

This is the command that executes the code path I'd like to debug:

./cmd/geronimo/geronimo revalidate --dir configs/ --name revalidate-test

How do I do this with delve?


Solution

  • You can use '--' to separate your arguments from delve's, something like this should do the trick.

    dlv exec ./cmd/geronimo/geronimo -- revalidate --dir configs/ --name revalidate-test