Also, to make things, I had to
- add the extension point in plugin.xml of goclipse
- do the following change in the com.googlecode.goclipse.gocode plugin
GoCodeClient.java, method getCompletions:
String ext = Environment.INSTANCE.getArch().getExecutableExt();
String cmd = Path.fromOSString(goroot).append("bin").append("gocode").toOSString();
ExternalCommand command = new ExternalCommand(cmd + ext);
which makes sure windows gets its exe extension.
Adrian
>
> Btw, can anyone drop a screenshot of gocode in goclipse? Just curious
> how it looks like there. :)
see attached.
I see, I'll look into it.
> However gocode -s is required to run. I get an error when using the
> client without previously starting the server. I did not have time to
> look into it.
I guess it's because client app expects gocode executable in $PATH. I'm
not sure how this will work on windows. Of course windows has $PATH
too, but as far as I remember it is not used a lot.
And maybe it should attach '.exe' as well when running executable.
So.. If you want to fix that, feel free to do this. I won't setup Go
environment on my windows machine, because windows is out of my
interests. Although I will make 'tcp' patch on my own.
>
> >
> > Btw, can anyone drop a screenshot of gocode in goclipse? Just curious
> > how it looks like there. :)
> see attached.
Nice :D
I think a more generic approach could use the configuration stuff in
gocode or something similar instead of referring to system variables
directly in the code which are clearly different on different systems.
I'm not sure about Mac OS if it has exactly the same names for
variables as Linux, but Windows clearly does not have them in that
exact form.
So instead of going for $PATH or $HOME or other things like this, just
have them written somewhere by the user or an installer script. Even
the name of the app could be written somewhere with sensible defaults
or at least the extension that appears only in windows.
There are some building issues now in goclipse but as soon as they are
fixed I will try to write a guide on how to build gocode within
goclipse. At the moment I had to do some changes to the code itself
just for the sake of building with goclipse - changed main package to
"gocode" package - and they are too ugly to be made public.
>
> So.. If you want to fix that, feel free to do this. I won't setup Go
> environment on my windows machine, because windows is out of my
> interests. Although I will make 'tcp' patch on my own.
>
My experience with Go is rather scarce so I'll wait for your tcp
implementation. Anyway you know gocode's code better than anyone so
you would know what goes best and where. For now, the exe I've
generated is enough to use within goclipse on windows with the new
plugin Graham wrote.
Thanks for the great work.
>> >
>> > Btw, can anyone drop a screenshot of gocode in goclipse? Just curious
>> > how it looks like there. :)
>> see attached.
>
> Nice :D
>
Adrian
> Although I will make 'tcp' patch on my own.
Done. Now you can run gocode with TCP socket. There are two
command-line options for that:
-sock=tcp
-addr=":37373"
The first one, "-sock=tcp", enables TCP socket code. The second one is
optional and lets you specify an address for listen function (server
mode) or an address for connection (client mode). By default it uses
just port 37373.
----------------------------------------------------------------------
[nsf @ ~]$ gocode -sock=tcp status
Server's GOMAXPROCS == 1
Package cache contains 1 entries
Listing these entries:
name: /home/nsf/go/pkg/linux_386/unsafe.a (default alias:
unsafe) imports 9 declarations and 0 packages
this package stays in cache forever (built-in package)
[nsf @ ~]$ netstat -tl | grep 37373
tcp 0 0 *:37373 *:* LISTEN
[nsf @ ~]$ gocode -sock=tcp close
[nsf @ ~]$ netstat -tl | grep 37373
----------------------------------------------------------------------
In order to close it as you can see, you should use "close" command
with "-sock=tcp" as well.
Anyways, I guess it provides the needed functionality. Maybe I will
move these things ("sock" and "addr") to the config file in future.
> Hey nsf,
> Thanks for being so responsive, and helping to get this working. And
> of course thanks for gocode, it's awesome.
>
> graham
Sure, np.
I'm interested in gocode integration to different editors, because it
will improve its quality. Therefore I'm ready to provide necessary
assistance.
So.. if there are any questions, you know my email. I'll keep an eye on
the goclipse and that mailing list in particular for a while. ;-)