Showing posts with label ide. Show all posts
Showing posts with label ide. Show all posts

2016-11-17

Best Golang IDE: IntelliJ and VSCode

I've been using IntelliJ + go-lang-idea-plugin for years now (because it's currently the best one for almost everything: Ruby, PHP, Python, Javascript, SQL, you name it..), previously it's ok to use SublimeText + GoSublime, or LiteIDE, but today we got another completely working alternative that is also purely free (like IntelliJ Community): VisualStudioCode + lukehoban.Go. Here's how to install in ArchLinux:

yaourt --needed --noconfirm -S --force visual-studio-code 
go get -u -v github.com/nsf/gocode      
go get -u -v github.com/rogpeppe/godef
go get -u -v github.com/golang/lint/golint
go get -u -v github.com/lukehoban/go-outline
go get -u -v sourcegraph.com/sqs/goreturns
go get -u -v golang.org/x/tools/cmd/gorename
go get -u -v github.com/tpng/gopkgs
go get -u -v github.com/newhook/go-symbols
go get -u -v golang.org/x/tools/cmd/guru
go get -u -v github.com/cweill/gotests/...
code

Then press Ctrl+Shift+P, type "Install Extension", type: "Go", done :3

Everything's works fine now:

In my opinion, IntelliJ still the best, but surely I'll be using VSCode when my IntellJ license ends.

2016-03-09

Lightweight Go IDE (with Debugging support)

Today I found that Visual Studio Code by Microsoft is quite charming, it based on Electron, library that being used to make Atom Editor (and Nuclide by Facebook). It loads fast, really fast. In ArchLinux or Manjaro, you can install it using this command:

yaourt -S visual-studio-code

After installing, type Ctrl+Shift+P, Install Extension, choose Go (Rich Go bla bla..). And yes, it requires internet connection.

Then install the tools required:

go get -u -v github.com/nsf/gocode
go get -u -v github.com/rogpeppe/godef
go get -u -v github.com/golang/lint/golint
go get -u -v github.com/lukehoban/go-find-references
go get -u -v github.com/lukehoban/go-outline
go get -u -v sourcegraph.com/sqs/goreturns
go get -u -v golang.org/x/tools/cmd/gorename
go get -u -v github.com/tpng/gopkgs
go get -u -v github.com/newhook/go-symbols

For debugging, install delve (it requires Go 1.5 or newer).

The import bulb will show if a package not yet imported:

The autocomplete just works as expected:

Argument tooltip (parameter info) shown correctly:

Jump to definition works (Ctrl+Click):

I believe this is better alternative (for now) than Atom, Brackets, LightTable, and LimeText (incomplete SublimeText implementation).

2015-02-03

How to build latest Go IDEA Plugin

As we already know, IntelliJ IDEA has the best Javascript and almost any other language auto-complete support, including database client and many useful linters and development tools. This tutorial intended to make IntelliJ as Go IDE, since last time I tried, the plugin (v0.9.6) is buggy and not good enough for daily use. First of all, the last plugin release (1.0.0-alpha11) is outdated, there's many bug that has been fixed after then. To build the latest package, use this command (or see first comment below for shorter command):

git clone --depth 1 git@github.com:go-lang-plugin-org/go-lang-idea-plugin.git
cd go-lang-idea-plugin
git checkout -b v1.0.0-alpha0
git branch --set-upstream-to=origin/v1.0.0-alpha0 v1.0.0-alpha0
git reset --hard origin/v1.0.0-alpha0
git pull
ln -s $YOUR_INSTALLED_IDEA_PATH idea-IC

alternatively, you can clone certain branch directly:

git clone -b v1.0.0-alpha0 https://github.com/go-lang-plugin-org/go-lang-idea-plugin.git
ln -s $YOUR_INSTALLED_IDEA_PATH idea-IC

Then open the directory using IntelliJ, open the File > Project Structure...


Make sure it has been configured as described in this link (rename the idea-IC SDK to IDEA sdk, assign that SDK to each module and project, install correct GrammarKit and ant plugin), when done, choose Build > Build Artifacts... > Go.zip to build the latest release on the bin/directory. Just install the zip file normally in plugins setting dialog. One more thing, to make this plugin works correctly, enter your $GOPATH value into Global Libraries and Project Libraries on Settings > Languages and Frameworks > Go Libraries. Voila! now your IDEA support Go programming language ^_^;


Or if building manually is taking too much of your time, you could download Go.zip file from this directory.

2014-11-26

How to install Goclipse and Golang IDEA plugin

Warning: current master version of these plugins (2014-11-25) are not good enough for daily coding, don't bother to try them for now.
Edit: latest alpha version of Golang IDEA plugin for IntelliJ are the best plugin for now.

Goclipse is another IDE for golang, that based on the infamous Eclipse platform. To install Eclipse, just type:

pacman -S eclipse

To install Goclipse, you must first clone the repository, for example using this command:

git clone --depth 1 https://github.com/GoClipse/goclipse.git

Then you must download all dependencies and start building:

cd goclipse
mvn clean integration-test
ant -f releng/ CreateProjectSite
ant -f releng/ PublishProjectSite

Last command would fail when not supplied with correct DprojectSiteGitURL parameter, but the required jars still resides in bin-maven/projectSite/, just use any webserver to serve the files as Eclipse update site, for example using php:

cd bin-maven/projectSite/
php -S localhost:9009

To install Goclipse, open Eclipse, Help > Install New Software..,  just add http://localhost:9009/releases

Then select Goclipse, next, accept the license, and finish.

Now the bad parts: bad coloring (for example, the operator color is not configurable), gocode doesn't work (even when GOPATH and GOROOT already configured on settings page and restarted), and autocomplete doesn't work at all.

Next we'll try IntelliJ with Golang IDEA plugin, first you must clone the repository:

git clone --depth 1 https://github.com/go-lang-plugin-org/go-lang-idea-plugin.git

Then place (or symlink) the IntelliJ program directory inside that folder that created by git, with name idea-IC, then just run:

ant -f build-package.xml

That command would produce a file named: google-go-language.jar, just install that plugin normally using on IntelliJ.

Now the bad parts: member autocomplete doesn't work at all (even when GOROOT and GOPATH configured on settings page and restarted).



2014-11-25

Wide: Web-based IDE for Go

Wide is one new web-based IDE, it has a lot of potential, for now, it has autocomplete and one that have working "go to definition".

To install Wide, type:

go get -u -v github.com/88250/ide_stub
go get -u -v github.com/nsf/gocode
go get -u -v github.com/b3log/wide

To start the program, type:

cd $GOPATH/src/github.com/b3log/wide/
wide

Then visit using your browser on http://your_ip_address:7070


There are some other web-based IDE such as GoDev (lags when showing godoc), LimeText, Carpo, Atom (aur/atom-editor-bin), Brackets.io, and Conception-go (this one not a web-based :3 it's OpenGL)
Btw, I make a list on GoogleDocs to list all Go IDEs, you can contribute/edit it if you want..

2014-08-23

Installing Go 1.3.1 with LiteIDE x23.2 on Arch Linux

So I installing new computer on my company, using Arch Linux as usual.

How to install Go? it's really easy when using yaourt, just type:

yaourt --needed --noconfirm -S --force go mercurial git bzr subversion liteide gdb

Go took about 40.76 MB
Mercurial, Git, Bzr and Subversion requires about 13.12 MB
LiteIDE took about 13.14 MB
Gdb took about 3.06 MB

Set your working directory:

mkdir ~/go
export GOPATH=~/go
export PATH=$PATH:~/go/bin


I suggest that you should put those environment variables on .bashrc

Then you can test the installation, create a file named test1.go

package main
import "fmt"
func main() {
  fmt.Println("Hello my lovely PC :3")
}


Run it using:

go run test1.go 

or

go build test1.go && ./test1

or press Ctrl+R on LiteIDE.

2014-08-04

Open Source Desktop Database GUI

When developing database apps sometimes we need easier user interface to query the database, instead of using command line (mysql for MySQL, psql for PostgreSQL), or using MySQL Workbench or the default pgAdmin. When you're using any of IDE from JetBrains you could use their Database Explorer.

DBeaver is one open source and cross platform database explorer, but it doesn't really work well with dark theme.
SQL Workbench also open source java-based database explorer, works fine with dark theme, but failed to display invalid Date.
Execute Query quite fine, I have no rants about this one.
Oh well I'll find and try another later on.

2014-07-31

How to set Komodo Edit as Go IDE with komodo-go

LiteIDE 23.1 is quite good enough IDE for Go in my opinion, the autocomplete and method hint works fine. All we need after installing is just configure the Environment file (View > Edit Environment) such as this:

GOROOT=/usr/lib/go
GOBIN=/home/kyz/Dropbox/go/bin

Don't forget to change the ownership or you won't able to save:

sudo chown `whoami` /usr/share/liteide/liteenv/*

Also don't forget to add custom GOPATH (View > Manage GOPATH..) if necessary


But sometimes the jump to declaration feature doesn't work at all.
There are another alternative that is komodo-edit, you can install it using:

pacman -Sy komodo-edit

Then you could clone the komodo-go repository:

cd /tmp
git clone https://github.com/Komodo/komodo-go
cd komodo-go

Make sure that you have installed Python 2.x, and then just built the extension

/opt/komodo-edit/lib/sdk/bin/koext build

Then drag the .xpi file into Komodo Extension Manager.
Now, install godef to make it support jump to declaration command:

go get -u -v code.google.com/p/rog-go/exp/cmd/godef

Now your komodo-edit with Go integration will work as expected.



2014-06-26

Dark Theme for RubyMine and PHPStorm

Today I want to share my theme, that been inspired a lot by Turbo C++ (my first IDE that I used to code when I started studying on Informatics Engineering).

For RubyMine: https://gist.github.com/kokizzu/bb2dfbabd0b649812fe8

For PhpStorm: https://gist.github.com/kokizzu/af51dd79e5140064b03c

2014-06-08

IDEs for Go

As programmer, we need good IDE (or just editor if you have good memory of the APIs), well.. In C/C++ we have QtCreator and Visual Studio, in Object-Pascal we Have Embarcadero Delphi, in Javascript we have Brackets.io or Webstorm, in Ruby we have RubyMine, in PHP we have PHPStorm, in Java-based languages (Scala, Clojure, Groovy) we have Eclipse, Netbeans and IntelliJ IDEA. What's for Golang?

First of all don't forget to set GOROOT (/usr/lib/go on ArchLinux) and GOPATH.

1. Vim + Vim-Go
Actually I've used vim for so long to edit a single source file, but not for IDE with many files, I've tried nedtree and many vim plugins but nothing capture my heart, except for the color scheme. Anyway you need Pathogen to install it easily, also YCM and the autocomplete works well (autocomplete: Ctrl+X + Ctrl+O). Sometimes when exiting vim it shows some error.

2. Goclipse
Just install eclipse pacman -S eclipse, add http://releases.goclipse.googlecode.com/git/ to the update site and install Goclipse. Set all the Go path configuration on the Preferences, kill gocode and start manually if necessary.
The autocomplete works fine. But the eclipse color configuration is quite annoying for dark theme desktop.

3. GolangIDE
Seems good, latest version was LiteIDE X26, cross-platform, available on ArchLinux via pacman -S liteide
set the correct GOROOT on your /usr/share/liteide/liteenv/linux64.env file (for 64-bit), and the autocomplete works fine!

4. IntelliJ IDEA CE + Golang Plugin
Just install IntelliJ IDEA Community Edition pacman -S intellij-idea-community-edition, go to plugins, browse, install Golang.
The autocomplete doesn't work well at all, it only shows sout, souf, soutm, soutp.
EDIT: it works by modifying the Exec= line of the .desktop file into: sh -c "/usr/bin/idea.sh" %f

Which one better?
I guess, for now I'll go with GolangIDE and Vim :3