go语言使用

  • 设置 package control

    • 在 Preferences->Package Setting->Package Control->Settings - User 中加入 channels, 不然连不上网.
     {
     "bootstrapped": true,
     "channels":
     [
     	"https://raw.githubusercontent.com/HBLong/channel_v3_daily/master/channel_v3.json"
     ],
         ...
    }
    
  • 设置 package GoSublime

    • 从github中直接下载GoSublime, 放入 package目录
  • 代码自动补全

    • 在 Preferences->Package Setting-> GoSublime->Settings - User 加入环境设置
    {
      "autocomplete_builtins": true,
      "autocomplete_closures": true,
      "env": {
         "GOPATH": "$HOME/go",
         "GOROOT": "/usr/local/go",
       }
    }
    
  • 查看函数帮助

    • go doc fmt
    • go doc fmt Printf or go doc fmt.Printf
    • go doc -src fmt.Fprintf
  • 函数运行

    • go run main.go

其他参考: https://morganwu277.github.io/2018/05/30/Setup-Golang-Dev-Env-in-Sublime-Text3/

原文地址:https://www.cnblogs.com/bregman/p/10906603.html