内容纲要

不管你在 .bash_profile 等环境变量里怎么设置 GOPROXY 还是 http_proxy 都不作用,还是得在 settings.json 里设置 http.proxy, 不然 go tools 安装不了。

settings.json

{
    "http.proxy": "http://192.168.1.104:7890/",    
    "go.inferGopath": true,
    "go.gopath": "/root/go",
    "go.goroot": "/opt/go",    
    "go.formatTool": "goformat",
    "go.autocompleteUnimportedPackages": true,
    "go.useLanguageServer": true,
    "[go]": {
        "editor.formatOnSave": true,
        "editor.codeActionsOnSave": {
            "source.organizeImports": true
        }
    }
}

settings.json

{
    "http.proxy": "http://192.168.2.76:7890",
    "go.inferGopath": true,
    "go.gopath": "/root/go",
    "go.goroot": "/opt/go",
    "go.formatTool": "goformat",
    "go.autocompleteUnimportedPackages": true,
    "go.useLanguageServer": true,
    "[go]": {
        "editor.formatOnSave": true,
        "editor.codeActionsOnSave": {
            "source.organizeImports": true
        }
    },
    "go.languageServerExperimentalFeatures": {
        "format": false,
        "autoComplete": true,
        "rename": true,
        "goToDefinition": true,
        "hover": true,
        "signatureHelp": true,
        "goToTypeDefinition": true,
        "goToImplementation": true,
        "documentSymbols": true,
        "workspaceSymbols": true,
        "findReferences": true,
        "diagnostics": false
    },
    "go.languageServerFlags": [
        "-rpc.trace", // for more detailed debug logging
        "serve",
        "--debug=localhost:6060", // to investigate memory usage, see profiles 
    ],
    "files.eol": "\n", // formatting only supports LF line endings
}

参考

发表评论

电子邮件地址不会被公开。 必填项已用*标注