vscode关于golang的配置

vscode关于golang的配置

调试配置

{
    // 使用 IntelliSense 了解相关属性。 
    // 悬停以查看现有属性的描述。
    // 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Launch",
            "type": "go",
            "request": "launch",
            "mode": "auto",
            "remotePath": "",
            "port": 2345,
            "host": "127.0.0.1",
            // "program": "${fileDirname}",
            "program": "${workspaceRoot}\\main.go",
            "env": {},
            "args": [],
            "showLog": false,
            // "output": "${workspaceRoot}\\bin\\db.exe",
            "output": "${workspaceRoot}\\pubinfo.exe",
            "cwd": "${workspaceRoot}\\"
        }
    ]
}

设置配置

使用gomod的配置

{
    "go.inferGopath": false,
    "go.gopath": "D:\\gopath;${workspaceRoot}",
    "terminal.integrated.env.windows": {
        "GOPATH":"D:\\gopath;${workspaceRoot}"
    },
    "terminal.integrated.env.linux": {
        "GOPATH":"D:\\gopath;${workspaceRoot}"
    },
    "debug.node.autoAttach": "on",
    "terminal.integrated.shell.windows": "C:\\Windows\\System32\\cmd.exe"
}

不使用gomod的配置

{
    "go.inferGopath": false,
    "go.gopath": "D:\\gopath;${workspaceRoot}",
    "terminal.integrated.env.windows": {
        "GOPATH":"D:\\gopath;${workspaceRoot}"
    },
    "terminal.integrated.env.linux": {
        "GOPATH":"D:\\gopath;${workspaceRoot}"
    },
    "debug.node.autoAttach": "on",
    "terminal.integrated.shell.windows": "C:\\Windows\\System32\\cmd.exe"
}
备案号:豫ICP备14002392号-2