使用 Delve 调试时将参数传递给可执行文件

Passing arguments to executable when debugging with Delve

我想在使用 dlv

执行时将参数传递给二进制文件
dlv --listen=:5432 exec /mypath/binary --config=config.toml

但是当我这样做时,出现以下错误:

Error: unknown flag: --config

如何在使用 dlv 调试器时将参数传递给二进制文件?

添加 -- 告诉 dlv 所有后续参数都应该逐字传递给二进制文件,而不是尝试解析它们:

dlv --listen=:5432 exec /mypath/binary -- --config=config.toml

参见Delve - Getting Started