Marsettler

Jaewan Park's blog

한국 카크로치디비 사용자 그룹 GitHub Tags
13 May 2018

Visual Studio Code debug speed up on Windows

On Visual Studio Code, Go debugging is very slow because that always rebuild everything.

If you set following settings on your .vscode folder Visual Studio Code will only build when changed.

launch.json

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Launch",
            "type": "go",
            "request": "launch",
            "mode": "exec",
            "port": 2345,
            "host": "127.0.0.1",
            "program": "${workspaceRoot}/main.exe",
            "preLaunchTask": "build-debug",
            "env": {},
            "args": [],
            "showLog": true
        }
    ]
}

tasks.json

{
    "version": "2.0.0",
    "tasks": [
        {
            "label": "build-debug",
            "type": "shell",
            "command": "vgo",
            "group": "build",
            "presentation": {
                "echo": true,
                "reveal": "never",
                "focus": false,
                "panel": "shared"
            },
            "args": [
                "build",
                "-i",
                "-gcflags",
                "'-N -l'"
            ],
            "windows": {
                "args": [
                    "-o",
                    "main.exe",
                    "\"${workspaceRoot}\\main.go\""
                ]
            },
            "problemMatcher": [
                "$go"
            ]
        }
    ]
}

2018년 05월 13일
박재완

tags: go vscode windows