nsf/gocode

Any further setups needed to get more intelligent completion?

Closed this issue · 2 comments

Hello, first of all thank you for maintaining this awesome project.

I'm using go-code on emacs with company-go.

For me, it works nice for standard libraries and local functions and variables, etc.

However I cannot get completion for imported packages from $GOPATH/src/.

For example, I want completion at this point, but it doesn't provide me any completion.

$GOPATH/src/example/example.go
package example

func Foobar() int {
    return 10
}

====================================
// trying to use package from here
package main

import (
    "example"
)

func main() {
    example.Foo|
}

Do I need more setups to get completion at this point?

Here's my settings.

.bashrc
export $PATH=$PATH:$HOME/git/go/bin:$HOME/go/bin
export $GOPATH=$HOME/go

.emacs.d/init.el
(require 'go-mode)                                                                                                                                
(require 'company-go)                                                                                                                             
(add-hook 'go-mode-hook                                                                                                                           
          (lambda ()                                                                                                                
            (add-to-list 'company-backends '(company-go))))  

Best Regards,
Seonghyun Park

nsf commented

Install the package: go install example. Package binary needs to be there for gocode to notice it. Gocode works with binary packages only when it comes to imported packages.

Now, it works quite nice with new packages.

Thank you for your early response!