0

My emacs go-lang setup is more or less the same as https://lupan.pl/dotemacs/.

I get suggestions from company-go for standard library (like fmt for example), but I don't get any suggestions from my own packages (that I am writing currently) whose sources reside in the same GOPATH.

Adding some explanation. The following is roughly how my code is organised.

My code is in

$GOPATH/src/mydomain.tld/myname/myproject/core/
$GOPATH/src/mydomain.tld/myname/myproject/feature1/
$GOPATH/src/mydomain.tld/myname/myproject/main.go

In main.go, I import code like so:

package main

import (
    "fmt"

    "mydomain.tld/myname/myproject/core/"
    "mydomain.tld/myname/myproject/feature1/"
)

func main() {
      // I expect to get a list of functions inside feature1 package, or at least a list of types in it. 
       variable1 := feature1.    

}

Any idea can be done to make company-go suggest completions from my own code ? Once again, I get suggestions from standard library packages just fine.

I use emacs-27 on FreeBSD-13.0 (GhostBSD 19.2), go 1.11

0

Apologies, some digging around with gocode -s -debug revealed that it couldn't resolve the import paths "mydomain.tld/myname/myproject/core/"

I then realised that I should be doing

"go install ./..." so that the all the code in "mydomain.tld/myname/myproject" will be recursively built and installed to $GOPATH/pkg.

I am new to Golang, and I realise this was a n00b question now.

  • I think this makes sense for other n00bs like me who'd wnat an emacs setup for Golang. – irumbumoideen Mar 23 at 7:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.