<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Weird rocketry &#187; golang</title>
	<atom:link href="http://webapp.org.ua/tag/golang/feed" rel="self" type="application/rss+xml" />
	<link>https://webapp.org.ua</link>
	<description>Flights to outer code</description>
	<lastBuildDate>Sat, 16 Jul 2016 11:12:13 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1</generator>
		<item>
		<title>Intellij IDEA and Go plugin</title>
		<link>https://webapp.org.ua/dev/intellij-idea-and-go-plugin/</link>
		<comments>https://webapp.org.ua/dev/intellij-idea-and-go-plugin/#comments</comments>
		<pubDate>Wed, 21 Aug 2013 13:39:59 +0000</pubDate>
		<dc:creator>bananos</dc:creator>
				<category><![CDATA[dev]]></category>
		<category><![CDATA[golang]]></category>
		<category><![CDATA[golang-idea-plugin]]></category>
		<category><![CDATA[IDEA]]></category>

		<guid isPermaLink="false">http://webapp.org.ua/?p=327</guid>
		<description><![CDATA[Ever wondered where to find IDE for programming Google Go language? Well, there are not a lot of choices out there and some of them lack pretty significant functionality, especially if you&#8217;re a newbie in Go like me. Some popular choices include: 1. LiteIDE the only IDE targeted specifically towards Go 2. GoSublime a Sublime [...]]]></description>
			<content:encoded><![CDATA[<div class="markdown-content">
<p><a href="http://webapp.org.ua/wp-content/uploads/2013/08/logo.png"><img class="alignleft size-full wp-image-336" title="logo" src="http://webapp.org.ua/wp-content/uploads/2013/08/logo.png" alt="" width="400" height="300" /></a>Ever wondered where to find IDE for programming Google <a href="http://golang.org">Go language</a>?<br />
Well, there are not a lot of choices out there and some of them lack pretty significant functionality, especially if you&#8217;re a newbie in Go like me.</p>
<p>Some popular choices include:</p>
<p>
1. <a href="https://github.com/visualfc/liteide">LiteIDE</a> the only IDE targeted specifically towards Go<br />
2. <a href="https://github.com/DisposaBoy/GoSublime">GoSublime</a> a Sublime Text plugin
</p>
<p>I&#8217;ve tried both of them and found out that both of them lack <code>Go to declaration</code> feature, which is crucual in the process of digging around new code. On top of that LiteIDE requires installation of <a href="https://github.com/nsf/gocode">gocode</a> daemon for autocompletion to work fine.</p>
<p>As you can see usage of these IDEs requires a lot of bells and whistles to get basic functioning.</p>
<p><br style="clear:both"/></p>
<p>However there&#8217;s a third option which I&#8217;m going to talk about in this post: <a href="https://github.com/mtoader/google-go-lang-idea-plugin">Google Go language plugin for IntelliJ Idea</a></p>
<p>It covers two of my initial requirements for Go IDE:</p>
<ol>
<li><code>Go to declaration</code> feature, i.e. you may click on any declaration and go check how it&#8217;s implemented under the hood</li>
<li><code>Autocompletion</code>, that&#8217;s a huge time saver and a great helper in exploring available options</li>
</ol>
<p>If you&#8217;re familiar with any Intellij IDEs you&#8217;ll get additional time-saving benefits too.  Let&#8217;s proceed!</p>
<p>As of time of this writing, there&#8217;s no up-to-date binary distribution of the plugin (hence, the post:),<br />
so we&#8217;re going to build everything from the sources.</p>
</div>
<p><span id="more-327"></span></p>
<div class="markdown-content">
<h2>Install IDEA community edition</h2>
<p>Go to <a href="http://www.jetbrains.com/idea/download/">Jetbrain download page</a> and install latest free community edition.<br />
As of time of this writing the latest IDEA version was 12.</p>
<h2>Grab IDEA sources!</h2>
<h3 id="post-327-md-2">Get Intellij IDEA community sources</h3>
<pre><code class="bash" title=""># repo is ~ 1gb, this may take a while
git clone git://git.jetbrains.org/idea/community.git idea
cd idea

# figure out what IDEA build you've just installed
cat /Applications/IntelliJ\ IDEA\ 12.app/build.txt; echo -e "\r\n";
IC-129.713

# checkout specified tag in the source repo
git checkout idea/129.713

# run ant to build everything
ant
</code></pre>
<p>Depending on the machine this may take 10-20min to compile.</p>
<h2>Grab Go plugin sources</h2>
<pre><code class="bash" title="">git clone https://github.com/mtoader/google-go-lang-idea-plugin.git
cd google-go-land-idea-plugin/

# compile plugin
ANT_OPTS=-Xmx1g ant -Didea.community.build=/Users/bananos/Projects/idea/ -f build-package.xml

Buildfile: /Users/bananos/Projects/google-go-lang-idea-plugin/build-package.xml

clean:

init:
[mkdir] Created dir: /Users/bananos/Projects/google-go-lang-idea-plugin/build
[mkdir] Created dir: /Users/bananos/Projects/google-go-lang-idea-plugin/dist
[echo] Using IDEA build from: /Users/bananos/Projects/idea/

compile:
[javac2] Compiling 561 source files to /Users/bananos/Projects/google-go-lang-idea-plugin/build

........................
........................
package:
[jar] Building jar: /Users/bananos/Projects/google-go-lang-idea-plugin/dist/ro.redeul.google.go.jar

BUILD SUCCESSFUL
Total time: 23 seconds

</code></pre>
<p>Make sure you specify correct <code>idea.community.build</code>  variable which should point to recently checked out IDEA community repo.</p>
<p>Unless you struggled with some critical errors, expect to find <code>*.jar</code> files:</p>
<pre><code class="bash" title="">ls -l dist/

total 1904
-rw-r--r--  1 bananos  staff  974789 Aug 21 15:55 ro.redeul.google.go.jar

</code></pre>
<p>This is a binary distribution we were looking for!</p>
<h2>Install plugin</h2>
<p>Run IDEA, and go to <code>Preferences-&gt;Plugins</code> and click <code>Install plugin from disk</code> button, then select <code>ro.redeul.google.go.jar</code> file from the previous step.</p>
<p><img class="aligncenter size-full wp-image-334" title="IDEA: Install plugin from disk" src="http://webapp.org.ua/wp-content/uploads/2013/08/idea-go-step1.png" alt="" width="901" height="468" /></p>
<h2>Install Go SDK</h2>
<p>Assuming that you&#8217;ve installed Go via <a href="http://mxcl.github.com/homebrew/">brew</a>, your Go SDK will be in <code>/usr/local/Cellar/go/1.1.1/</code></p>
<p>Go to the <code>File -&gt; Project Structure</code> and configure Go SDK by clicking <code>+</code> button and<br />
selecting <code>/usr/local/Cellar/go/1.1.1/</code> folder.</p>
<p style="text-align: center;"><img class="aligncenter size-full wp-image-334" title="IDEA: Configure Go sdk" src="http://webapp.org.ua/wp-content/uploads/2013/08/idea-go-step2.png" alt="" width="857" height="472" /></p>
<p>Make sure to add your project <code>pkg</code> folder under <code>Classpath</code> and your project sources under <code>Sourcepath</code> tabs.</p>
<h2>TL;DR</h2>
<p>For lazy ones, here is a link to <a href="/wp-content/uploads/2013/08/ro.redeul.google.go.jar">compiled binary</a>!</p>
</div>
]]></content:encoded>
			<wfw:commentRss>https://webapp.org.ua/dev/intellij-idea-and-go-plugin/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
