设置代理:

设置-> 应用程序 -> 代理服务器 -> proxy 设置为 http://127.0.0.1:10080

安装插件

GO: Install/Update Tools

VS Code golang环境配置 - 图1

修改配置

设置 -> 扩展 -> GO -> Alternate Tools -> 点击 编辑setting.json

  1. {
  2. "files.autoSave": "onFocusChange",
  3. "go.buildOnSave": "workspace",
  4. "go.lintOnSave": "package",
  5. "go.vetOnSave": "package",
  6. "go.buildTags": "",
  7. "go.buildFlags": [],
  8. "go.lintFlags": [],
  9. "go.vetFlags": [],
  10. "go.coverOnSave": false,
  11. "go.useCodeSnippetsOnFunctionSuggest": false,
  12. "go.formatOnSave": true,
  13. //"go.formatTool": "goreturns",
  14. "go.goroot": "C:\\Go",
  15. "go.gopath": "D:\\gopath",
  16. "go.gocodeAutoBuild": false,
  17. "workbench.iconTheme": "vscode-icons",
  18. "go.useLanguageServer": true,
  19. "http.proxy": "http://127.0.0.1:10080",
  20. "http.proxyStrictSSL": false,
  21. "terminal.integrated.shell.windows": "C:\\Windows\\System32\\cmd.exe",
  22. "workbench.colorTheme": "Monokai",
  23. "go.addTags": {
  24. },
  25. "go.alternateTools": {
  26. },
  27. "go.autocompleteUnimportedPackages": true,
  28. "go.docsTool": "gogetdoc",
  29. "go.formatTool": "goimports",
  30. }