设为首页 加入收藏

TOP

Programming in Go (Golang) – Setting up a Mac OS X Development Environment(二)
2017-09-30 13:46:42 】 浏览:3296
Tags:Programming Golang Setting Mac Development Environment
quivalent, full-featured IDEs for Go.  So what’s the best IDE for Golang? After trying several options which included LiteIDE, IntelliJ Go Plugin, Go-IDE and Atom, I personally settled on using Sublime Text and iTerm.

Sublime Text

Sublime Text 3 along with the GoSublime package provides several features to improve Go programming productivity.  I also setup a Sublime Project for each of my Go projects which contains a sublime-project file and sublime-workspace file.  If your project needs specific environment variables you can set those in your sublime-project file by adding the following:

{
  "settings": {
    "GoSublime": {
      "env": {
        "APP1_ENV": "test",
        "APP1_HOME": "/var/app1"
      }
    }
  }
}

 

When getting started with Sublime, I stubbled upon the Get Go-ing with Sublime post by Tyler Bunnell which contains several tips and tricks when using Sublime and GoSublime.  If you decide to use Sublime, I encourage you to check out Tyler’s post.  The best tip is customizing the preferences to run `go build` and `go test` upon saving a go file which I slightly modified.  Below are the Gosublime preferences I use:

{
  "on_save": [
    {
      "cmd": "gs9o_open",
      "args": {
        "run": [
          "sh",
          "go build && go test -i && go test && go fmt && go vet"
        ],
        "focus_view": false
      }  
    }
  ],
  "autocomplete_closures": true,
  "complete_builtins": true,
  "fmt_cmd": [
    "goimports"
  ]
}

 

In addition to using the GoSublime package, I also use the SublimeGit and GitGutter packages to interact with GitHub.  When I am ready to run my application, I use iTerm2 instead of trying to run in the GoSublime console.  Sublime Text along with the numerous packages provide a ton of shortcuts and features to improve productivity.

Setting up my current Go development environment did not happen overnight.  In fact, I spent numerous hours researching and eva luating different tools, best practices and conventions.  I encourage you to find a setup that works best for you and hopefully this information will save you a couple of hours!

首页 上一页 1 2 下一页 尾页 2/2/2
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇Go语言开发环境配置 下一篇造完美的go开发环境

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目