Skip to content
This repository has been archived by the owner on Oct 27, 2021. It is now read-only.

can't find package in gopath #102

Closed
gameFu opened this issue Jan 11, 2019 · 12 comments
Closed

can't find package in gopath #102

gameFu opened this issue Jan 11, 2019 · 12 comments

Comments

@gameFu
Copy link

gameFu commented Jan 11, 2019

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

@stamblerre
Copy link
Collaborator

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

@thatjames
Copy link

thatjames commented Jan 14, 2019

@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?

@stamblerre
Copy link
Collaborator

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.

@Vizualni
Copy link

Having the same issue :/

@stamblerre
Copy link
Collaborator

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

@hilaily
Copy link

hilaily commented Jan 26, 2019

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.

@stamblerre
Copy link
Collaborator

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

@sethgrid
Copy link

sethgrid commented Feb 3, 2019

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.

@stamblerre
Copy link
Collaborator

@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.

@mengzhuo
Copy link

@stamblerre go install . under workspace works for me.

@gameFu
Copy link
Author

gameFu commented Feb 18, 2019

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

@zylikedream
Copy link

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants