1. Make sure $GOPATH/bin is in your $PATH (Windows: %GOPATH%\bin goes in your %PATH%). 【保证你的golang环境正常】
  2. Run go get -u golang.org/x/tools/cmd/goimports (you may have to install mercurial). 【通过go下载工具】
  3. Install Sublime Text and GoSublime (or make sure you’ve got the latest update if it’s already installed). 【安装了sublime text 和 Gosublime插件】
  4. Open the gosublime user config/preference file (Mac: ⌘. ⌘5 Windows: Ctrl+. Ctrl+5). Make sure you keep the command button down for the whole shortcut sequence. 【进行配置】
  5. Make it look like this:
{
    "fmt_cmd": ["goimports"]
}

然后,你在保存的时候,如果漏掉了系统import的包,就会自动帮你import。

个人感觉,copy的代码更需要这个。自己新写的代码,一般都会记得包含,因为不import对应的包, Gosublime就没办法进行函数的提示了。

相关文章:

  • 2021-11-30
  • 2021-08-14
  • 2022-12-23
  • 2021-12-20
  • 2021-07-11
  • 2021-11-30
  • 2021-10-12
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-12-14
  • 2021-10-14
  • 2021-08-13
  • 2022-12-23
  • 2021-08-10
  • 2022-01-11
相关资源
相似解决方案