Wednesday, September 3, 2014

Getting GoSublime to work with App Engine's Golang runtime



To us sublime text junkies, not being able to use sublime when writing a certain language can go as far as disqualifying the technology.

In the case of Golang, there is some built in Go functionality in Sublime Text, but it's limited to some syntax helpers. 

To be able to get quality code completion features - which is very important for us Golang beginners (in a sense, everyone is a beginner in Go, the language is quite new) - you want to use something like GoSublime

But, if you are using Go with the App Engine runtime for some reason (there are good reasons for that, depending on your use-case),  you would have to configure some stuff before getting GoSublime to work. 

App engine's Go distro is a weird one, it's not identical to the normal Go language package. 

Here's what you need to do to get GoSublime working on Sublime Text with App Engine after you have installed the GoSublime package with the package installer:


1. Get to Sublime Text -> Preferences -> Package Settings -> GoSublime -> Settings - default




2. Add App Engine's GOROOT and GOPATH directories to the "env" setting. Otherwise, GoSublime will keep bugging you with an error message about not finding those dirs:
In my case, I put the SDK under my user:
"env": {
"GOROOT": "/Users/orcaman/go_appengine/goroot",
"GOPATH": "/Users/orcaman/go_appengine/gopath"

},
This is how it looks like:



3. Now, you want to create the following symbolic links (or just copy paste of you are lazy):

3.1. $ cp /Users/orcaman/go_appengine/goroot/bin/goapp /Users/orcaman/go_appengine/goroot/bin/go
3.2. $ cp -rf /Users/orcaman/go_appengine/goroot/pkg/darwin_amd64_appengine /Users/orcaman/go_appengine/goroot/pkg/darwin_amd64

Now you should be good to go with awesome code completion and stuff like that:


No comments:

Post a Comment