Visual Studio Code配置Go环境

本文最后更新于 1649 天前, 如有失效请评论区留言.

vscode配置

安装好Go相关插件,配置工具包

使用command+shift+P快捷键,然后键入Go: Install/Update Tools选中全部(根据需要),稍等片刻,就会安装完成。

自定义配置项

{
    "git.autofetch": true,
    "files.autoSave": "onWindowChange",
    "workbench.colorTheme": "Go - Sources",
    "terminal.integrated.shell.osx": "/bin/zsh",
    "go.autocompleteUnimportedPackages": true,
    "go.gocodeAutoBuild": true,
    "go.useLanguageServer": true,
    "goOutliner.enableDebugChannel": true,
    "goOutliner.extendExplorerTab": true,
    "go.inferGopath": true,
    "go.docsTool": "godoc",
    "go.gocodePackageLookupMode": "go",
    "go.gotoSymbol.includeImports": true,
    "go.useCodeSnippetsOnFunctionSuggest": true, //使用代码片段提示
    "go.useCodeSnippetsOnFunctionSuggestWithoutType": true,
    "go.formatTool": "goimports", //代码格式化
   // "go.buildOnSave": true, //保存代码时自动编译
    "go.lintOnSave": "file", //保存代码时优化
    "go.vetOnSave": "package", //保存代码时检查潜在错误
    "go.coverOnSave": false //保存代码时执行测试
}

Sponsor

Like this article? $1 reward

Comments