Marsettler

Jaewan Park

한국 카크로치디비 사용자 그룹 카크로치디비 스프린트 카크로치디비 문서 한글화 프로젝트 GitHub Q & A Tags
13 May 2018

Visual Studio Code debug speed up on Windows

by Jaewan Park

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"
            ]
        }
    ]
}
tags: go vscode windows