Roman Kazmin
Roman Kazmin

Reputation: 981

Cannot set arguments for go app during debugging

I'm trying to debug my goland app and have some problems with launch.json file. My app should be run with argument: my_go_app -c path_to_config.

My launch.json looks like:

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Launch my go app",
            "type": "go",
            "request": "launch",
            "mode": "auto",
            "program": "${fileDirname}",
            "args": ["-c /home/roman/projects/myapp/some.json"]
        }
    ]
}

But when I debug app I have received the following error:

flag provided but not defined: -c /home/roman/projects/myapp/some.json Usage of /tmp/__debug_bin542579318: -c string Specify the configuration file. (default "config.json")

Without debugging my app runs with success. Please explain what is wrong...

Upvotes: 1

Views: 1945

Answers (1)

Roman Kazmin
Roman Kazmin

Reputation: 981

I have found where is problem. The json should be like this:

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Launch my go app",
            "type": "go",
            "request": "launch",
            "mode": "auto",
            "program": "${fileDirname}",
            "args": ["-c",  "/home/roman/projects/myapp/some.json"]
        }
    ]
}

Upvotes: 2

Related Questions