Search code examples
godebuggingdelve

dlv substitute-path example in config.yml


Any example to set from and to path in $HOME/.dlv/config.yml ? I have tried setting:

case 1 ( with quotes in from and to) substitute-path:

{"from":
"/private/var/tmp/_bazel/d3eb9a0ef06857aebc54b41ff425d2ee"
"to": "/Users/xxx/code/src"}

case 2: ( without quotes in from and to) substitute-path:

{from:
"/private/var/tmp/_bazel/d3eb9a0ef06857aebc54b41ff425d2ee"
to: "/Users/xxx/code/src"}

case 2: ( with hyphan before '{from' ) substitute-path:

-{from:
"/private/var/tmp/_bazel/d3eb9a0ef06857aebc54b41ff425d2ee"
to: "/Users/xxx/code/src"}

case 2: ( with hyphan before '{from' ) substitute-path:

-{"from":
"/private/var/tmp/_bazel/d3eb9a0ef06857aebc54b41ff425d2ee"
"to": "/Users/xxx/code/src"}

all 4 cases fails with config. error. any working sample to set the path?


Solution

  • I think you are missing a space. The quotes are relevant only if the values or keys have spaces in them, or some other non-printable, non-ascii characters.

    The config here, without comments:

    $ cat ~/.config/dlv/config.yml | sed '/^#/d; /^$/d'
    aliases:
      # command: ["alias1", "alias2"]
    substitute-path:
      - {from: /my/source/code/was/here, to: /but/now/its/here}
    debug-info-directories: ["/usr/lib/debug/.build-id"]
    

    Seems like valid yaml:

    $ yq < ~/.config/dlv/config.yml 
    {
      "aliases": null,
      "substitute-path": [
        {
          "from": "/my/source/code/was/here",
          "to": "/but/now/its/here"
        }
      ],
      "debug-info-directories": [
        "/usr/lib/debug/.build-id"
      ]
    }
    

    The yq tool is a wrapper for jq.

    $ yq --help | sed 8q
    usage: yq [options] <jq filter> [input file...]
              [jq_filter] [files [files ...]]
    
    yq: Command-line YAML processor - jq wrapper for YAML documents
    
    yq transcodes YAML documents to JSON and passes them to jq.
    See https://github.com/kislyuk/yq for more information.