nsf/gocode

GOCODE DOES NOT WORK WITH OR WITHOUT GOMODULES ENABLED

p554157atch opened this issue · 6 comments

This error shows up constantly all the time, tried to solved it for 10 hours but does not work:

Error parsing input file (outer block):
2020/08/20 07:26:52  /mnt/data/data/go/src/private/pgtableinvoice/pgtableinvoice.go:323:9: expected selector or type assertion, found ';'
2020/08/20 07:26:52 gbimporter: no package found for ./commonmessage: can't find import: "/mnt/data/data/go/src/private/pgtableinvoice/commonmessage"
2020/08/20 07:26:52 gbimporter: no package found for ./logger: can't find import: "/mnt/data/data/go/src/private/pgtableinvoice/logger"
2020/08/20 07:26:52 gbimporter: no package found for ./postgresdb: can't find import: "/mnt/data/data/go/src/private/pgtableinvoice/postgresdb"

go version go1.14.5 linux/amd64

Want to re-produce it yourself?
Just install Spacemaces from develop or master branch, your gocode won't give 1 correct suggestion for imported packages whether or not they are using gomodules.

@p554157atch read the README again:

VERY IMPORTANT: this project is not maintained anymore, look for alternatives or forks if you need Go autocompletion tool

The majority of Go developers in the community switched to gopls more than a year ago. I suggest you to do the same.

Spacemacs company-mode, that calls company-go is still using gocode for its output.
This is supposed to work with GOMODULES disabled.

You can try https://github.com/mdempsky/gocode if you don't need modules support, or https://github.com/stamblerre/gocode if you do.

But long term, you should probably look into switching from company-mode to lsp-mode (with gopls), or ask spacemacs to look into this.

@p554157atch the fact that you are using company-mode is irrelevant. Gocode was marked as “unmaintained” by the author so you should not expect them to fix the problems you are having on Spacemacs. As I suggested before, you should switch to gopls like the rest of the Go developers in the community. Please refer to this issue on spacemacs that was opened specifically to discuss problems with company-go. There you will find that other people have suggested to replace company-mode with lsp-mode which works with gopls (both with and without Go modules).

@cixtor Or, crazy idea, the go layer and the defaults could be fixed to have that configuration out of the box? Or at least the go layer documentation could be taken down as it is outrageously incorrect and out-of-date?