mdempsky / gocode

An autocompletion daemon for the Go programming language

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

can't find package in gopath

gameFu opened this issue · comments

this is gocode -s -debug output
image
I am pretty sure that the paths to these packages are in my gopath. only find system built-in packages like fmt and time

image
image

vscode version
image

Do you have files like $GOPATH/pkg/darwin_amd64/bingo/monitor.a?

@stamblerre I finally stumbled upon this answer and I can say this is the issue my side, but I have no idea how to build these objects... How do we do so?


EDIT Managed to do it by tanking the pkg dir and rebuilding my directories. Is there a cleaner approach for this or are we waiting for the modules rewrite?

You should be able to build .a files by running go install <package>. You can use go install -i <package> to build the .a file for the package and its dependencies.

Having the same issue :/

@Vizualni: Do you have .a files under $GOPATH/pkg?

commented

I have the same issue too. And there are no .a file in my $GOPATH/pkg.
I think it is because the new go cache. After go1.10, go install is not update cache in pkg file. Like this issue said nsf#500.
I tried go install -i, and it is work.

@laily123: Yes, goinstall -i is the correct solution to this problem.

I think this is related to #46.
I did a go get -u -v github.com/stamblerre/gocode and gocode close (might have done a gocode exit for good measure) and restarted gocode with gocode. I now have autocomplete in VS Code again.

I think my issue was the same as yours:
running $ gocode -s -debug
on line 12 of here, start to type c.

2019/02/03 08:35:40 Cursor at: 202
2019/02/03 08:35:40 -------------------------------------------------------
package main

import (
	"github.com/sethgrid/simplequest/dungeon"
)

func main() {
	// get config, run game
	d := dungeon.MakeDungeon()
	c := d.NewCell("0,1")
	c.Description("you are in a clearing")
	c.#
}
2019/02/03 08:35:40 -------------------------------------------------------
2019/02/03 08:35:40 Error parsing input file (outer block):
2019/02/03 08:35:40  /Users/sethammons/workspace/go/src/github.com/sethgrid/simplequest/cmd/quest/main.go:12:4: expected selector or type assertion, found ';'
2019/02/03 08:35:40 gbimporter: no package found for github.com/sethgrid/simplequest/dungeon: can't find import: "github.com/sethgrid/simplequest/dungeon"
2019/02/03 08:35:40 Elapsed duration: 464.741µs
2019/02/03 08:35:40 Offset: 0
2019/02/03 08:35:40 Number of candidates found: 0
2019/02/03 08:35:40 Candidates are:
2019/02/03 08:35:40 =======================================================

I tried this both in and out of my GOPATH. I'm not sure what the module system has done to my work set up, but things have been messed up for sure, and this made VS Code no more useful than an auto-formatter.

@sethgrid: For modules support, you should use stamblerre/gocode. mdempsky/gocode does not support modules. VSCode downloads both and renames the stamblerre/gocode binary to gocode-gomod, so both versions can coexist.

@stamblerre go install . under workspace works for me.

@stamblerre yes,this problem is loss .a file. go install this project genrate .a flie is the correct solution to this problem

is that means, every time I change my package, I have to install it ?