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


In main.go, I import code like so:

package main

import (


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


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 '19 at 7:52
  • I ran into the same problem. You can configure gocode to rebuild packages automatically using: gocode set autobuild true – clemera Jul 23 '19 at 18:37

If you use flycheck, set

(setq flycheck-go-build-install-deps t)

This will install your dependencies automatically. More details in flycheck docs: https://www.flycheck.org/en/latest/languages.html#go

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.