在 VS Code 中,使用快捷键:command+shift+P,然后键入:go:install/update tools,将所有 的插件都勾选上,然后点击 OK 即开始安装。

 

 

  1. 当我们在使用 import 功能的时候,如果无法通过 lint 检查,则不会执行自动 import。
  2. 如果你需要自动 import 的前提是你必须把要导入的包的函数写完整。

附带我的 settings.json

{
  "go.goroot": "",
  "go.gopath": "",
  "go.inferGopath": true,
  "go.autocompleteUnimportedPackages": true,
  "go.gocodePackageLookupMode": "go",
  "go.gotoSymbol.includeImports": true,
  "go.useCodeSnippetsOnFunctionSuggest": true,
  "go.useCodeSnippetsOnFunctionSuggestWithoutType": true,
  "go.docsTool": "gogetdoc",
}

亲测有效

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-11-29
  • 2021-05-25
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-02-01
  • 2021-04-03
  • 2021-06-20
  • 2022-12-23
  • 2021-04-08
  • 2022-01-23
相关资源
相似解决方案