echo + swag + vscode

I'm building a REST service in #golang and currently have no client so I am relying on my Swagger docs to be able to exercise my endpoints but with my approach to maintain debugging in #vscode I had to rebuild the swagger docs via CLI first.

This is very annoying

After some reading I discovered the tasks.json for vscode and can execute by adding preLaunchTask to your debug configuration like this:

{
    "version": "0.2.0",
    "configurations": [
        {
            "preLaunchTask": "swag",
            "name": "server",
            "type": "go",
            "request": "launch",
            "mode": "debug",
            "program": "./"
        }
    ]
}

launch.json

{
    "version": "2.0.0",
    "tasks": [{
        "label": "swag",
        "command": "swag",
        "args": ["init", "--parseDependency", "--parseInternal"],
        "type": "shell"
    }]
}

tasks.json

Subscribe to Openbracket

Sign up now to get access to the library of members-only issues.
Jamie Larson
Subscribe