3

I'm trying to use LiteIDE (the Go IDE) on Linux 32-bit. Everything works except for autocomplete. Builds, running, everything works. The gocode binary seems to be running tho:

ithisa@miyasa ~> ps aux | grep gocode
ithisa   10003  0.0  0.0 823788  2624 pts/1    Sl+  09:06   0:00 /home/ithisa/scratch/liteide/bin/gocode -s -sock unix -addr localhost:37373

What might I be doing wrong?

OneOfOne
  • 95,033
  • 20
  • 184
  • 185
ithisa
  • 752
  • 1
  • 8
  • 25
  • Auto-complete works for me, using 12.04 LTS (32 bit). I followed EXACTLY the instructions here, **all of them**: [FreeBSD, Linux, Mac OS X and NetBSD tarballs](http://golang.org/doc/install#bsd_linux) Then I installed LiteIDE from here: [LiteIDE x18.2.1 Linux (x86 32bit)](http://code.google.com/p/golangide/downloads/detail?name=liteidex18.2.1.linux-386.tar.bz2) Everything worked first time, every time. – Vector Nov 10 '13 at 21:41
  • Hmm. I was using the Debian Unstable-supplied Go from the repos rather than manually installing from Google...Debian usually packages things correctly; probably the reason is that it was Debian Unstable, which sometimes has not-so-tested packages. – ithisa Nov 10 '13 at 22:22
  • I installed the official Go packages. Still no autocompletion... – ithisa Nov 10 '13 at 22:38
  • DK - I would remove everything and start from scratch. I had nothing at all related to Go on my machine when I started, and followed the instructions exactly. I was amazed at how hassle free it was - I had a project (with autocomplete) running in LiteIDE in about half an hour from start @ 0. I'm finding I like LiteIDE - I come from Delphi/C++/Python and I always need a good IDE - hate messing with all the other bs - just want to write my code and build it. LiteIDE seems to handle the job-good debugging, tracing-at least enough to get you going. Have not done any big projects with Go yet. – Vector Nov 10 '13 at 23:06
  • I just did remove everything and start from scratch. All the go tools work, everything in LiteIDE works, EXCEPT for autocomplete on the existing libraries (autocomplete on keywords, and stuff I write on my own, work). Seems to be a problem with `gocode`. – ithisa Nov 11 '13 at 00:09
  • OK, well - I can't say for sure that autoComplete works right for **everything**. Haven't paid that much attention yet. Maybe I've only been seeing it on the things you mentioned now. I will be messing around with it some more over the next few days.... – Vector Nov 11 '13 at 02:40
  • OK - I was messing with it over the weekend - looks like I've got the same behavior over here: No autoComplete for imported packages, just for keywords and locally defined code. Have not tried with my own packages yet. – Vector Nov 12 '13 at 19:36
  • I had a problem like this that went away after I set set some default paths, though I don't know which part of the setup process fixed it. 1) In LiteIDE, try View->Manage GOPATH and put your workspace dir and your Go directory under 'Custom directories': `/home/bob/gowork` and `/home/bob/go`, say. 2) Use the "Edit environment" button in the Environment toolbar (also accessible through View->Options->LiteEnv) to make sure `GOROOT=/home/bob/go` and `GOPATH=/home/bob/gowork` are set for the environment you're using. 3) `killall gocode` and restart LiteIDE. Good luck! – twotwotwo Nov 13 '13 at 01:42

4 Answers4

9

You may need to set a GOROOT=. To set it within LiteIDE, look for the environment toolbar; it should be a a dropdown, probably with "system" preselected, and a button. Click the button to bring up the Edit Environment pane, then double-click "system.env", or whichever environment was picked in the dropdown.

Change the line that starts GOROOT= to point to your 'go' directory. Plain old $HOME/go is a common setting if you installed it from golang.org, and if you don't know where it is, running go env will show the GOROOT that the Go toolchain itself is using. And of course if the line is commented out (#GOROOT=...) remove the #. Save.

If the toolbar is missing entirely, View -> Environment toolbar unhides it.

It's probably also worth setting GOROOT and related settings in your .bashrc, so tools started from the command line see it. I installed Go and LiteIDE in my homedir and my workspace is ~/gocode, so mine is like:

export PATH="$HOME/go/bin:$HOME/liteide/bin:$PATH"
export GOROOT=$HOME/go
export GOPATH=$HOME/gocode

I can't be certain this is actually your issue, but if I unset my GOROOT the symptom matches what you're seeing: completion works on my code, but not on the standard library. Good luck!

twotwotwo
  • 28,310
  • 8
  • 69
  • 56
  • What should I set GOROOT to? Debian installs Go into `/usr/lib` and `/usr/bin` and a whole bunch of other Unixy places; should I uninstall Debian's Go and install Go into my homedir? – ithisa Nov 14 '13 at 13:43
  • Um, good question. Running `go env` will give you Go's environment variables, and it looks like your `GOROOT` will be `/usr/lib/go`. (Updating my answer.) – twotwotwo Nov 14 '13 at 19:25
  • 1
    As a windows user I changed system to win64 in the dropdown and gocode started working immediately. Yay code prediction/auto complete – M Y Feb 28 '17 at 16:26
2

Did you install gocode?

https://github.com/nsf/gocode

Also, does nothing autocomplete or just new packages? Packages need to be installed to autocomplete. Do you have a standard install setup?

Your GOROOT and GOPATH should also be correctly setup.

Daniel Williams
  • 8,673
  • 4
  • 36
  • 47
2

I've got the exact same problem, except for 64-bit linux (ArchLinux)

I got this solved by:

set up correct GOROOT and GOPATH, for example:

$ cat ~/.bashrc | grep GO
export GOROOT=/usr/lib/go
export GOPATH=~/goroot
PATH="$PATH:$GOPATH/bin"
bash

installing/starting gocode daemon

$ go get -u github.com/nsf/gocode
$ gocode -addr=:37373
$ gocode status

set correct GOROOT on LiteIDE config file:

sudo vim /usr/share/liteide/liteenv/linux64.env
GOROOT=/usr/lib/go
Kokizzu
  • 24,974
  • 37
  • 137
  • 233
2

For me gocode (autocomplete) broke in LiteIDE after updating Go to the latest version.

What I did was make sure GOPATH was set correct. Then install gocode:

go get -u github.com/nsf/gocode

Then remove the gocode version from the liteide/bin/ folder, because else LiteIDE will use its own version (I only renamed it just in case).

Now when you boot LiteIDE it should say

GolangCode: Found gocode at <YOUR GOPATH>/bin/gocode

instead of LiteIDE using its own version.

JtotheR
  • 503
  • 5
  • 5