Saturday, August 29, 2015

playing with GO and setting up Atom for golang

i thought it might be good idea to make my first steps with Go (or is it GO?) in an IDE, so after a quick search i decided i don't want to go as far as eclipse and gave a try to LiteIDE.
and, for the first time i needed a tutorial on an IDE. i mean, even eclipse has its quirks, android developer as well, but LiteIDE is totally obscure, no documentation, and unfortunately not much info - so what does the developer think to gain some audience for this otherwise nice looking tool?

so on we go - to Atom.
i used Atom before in various environments so that was an easy decision.
to utilize Go here you need go-plus extension for Atom.
But after i installed it, it spit some error messages:

GOPATH: Not Set (You Should Try Launching Atom Using The Shell Commands...)
Cover Tool: /usr/local/go/pkg/tool/linux_386/cover
Vet Tool: /usr/local/go/pkg/tool/linux_386/vet
Format Tool (goimports): Not Found
Lint Tool: Not Found
Gocode Tool: Not Found
Godef Tool: Not Found
Gocode Status: Enabled
Oracle Tool: Not Found

ok, lets go one by one:

 GOPATH - thats fine, you export in  (Linux) as prescribed in all Go docs; add it to .profile for persistance. i did, but hadn't login so the setting didn't go into effect

goimports - whatever it does,running "go get golang.org/x/tools/cmd/goimports" installs it

same with The Oracle (whooooo) - go get golang.org/x/tools/cmd/oracle, does it

same with godef - go get golang.org/x/tools/cmd/godef
Ooops, no - now it complains about hg not found; wtf is hg?
ok, installing mercurial took only a few seconds so the souls using it instead of git are forgiven (for now).
ok, but not ok - go get code.google.com/p/rog-go/canvas still spits some crap - apparently google shutting down code.google.com has its side effects on its pet inhouse (gone wild in public) language.
try again with  go get -v github.com/9fans/go spits "no buildable Go source files"

i read some advice on reddit to  mv ../github.com/9fans/ ../9fans.net
but this helped with nothing, and only when i accidentally found an article about godef integration in Sublime, i found a correct path for this crap:
go get -v github.com/rogpeppe/godef

 gocode is flawless at github with go get github.com/nsf/gocode

lint tool you get from here: go get github.com/golang/lint/golint

in fact i see now that this link was very helpful - http://dominik.honnef.co/posts/2014/12/an_incomplete_list_of_go_tools/#golint

now, packaging is cool, but really no body from google, ah sorry - golang - thought about having a centralized hub? a reliable one, like something we can count on not to disappear and devastate time and efforts? blah

ok, going to log off now and see if all these had any effect..

yes indeed!

Go: go1.5 linux/386 (@/usr/local/go/bin/go)
GOPATH: /home/user/work
Cover Tool: /usr/local/go/pkg/tool/linux_386/cover
Vet Tool: /usr/local/go/pkg/tool/linux_386/vet
Format Tool: /home/user/work/bin/goimports
Lint Tool: /home/user/work/bin/golint
Gocode Tool: /home/user/work/bin/gocode
Godef Tool: /home/user/work/bin/godef
Gocode Status: Enabled
Oracle Tool: /home/user/work/bin/oracle
Git: /usr/bin/git
PATH: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/local/go/bin
Atom: 1.0.7 (linux ia32 3.19.0-26-generic)

ok, so now lets see if Atom+Go can do wonders to stun the programming world!


Update: I only played with Atom for 15 minutes when I realized that LiteIDE was actually superbly integrated will Go tools :) so now I do all my Go development in LiteIDE

No comments :