Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/go: linker.exe not looking in GOPATH for some packages #18050

Closed
pigeonhands opened this issue Nov 25, 2016 · 5 comments
Closed

cmd/go: linker.exe not looking in GOPATH for some packages #18050

pigeonhands opened this issue Nov 25, 2016 · 5 comments

Comments

@pigeonhands
Copy link

pigeonhands commented Nov 25, 2016

Please answer these questions before submitting your issue. Thanks!

What version of Go are you using (go version)?

version go1.7.3 windows/amd64

What operating system and processor architecture are you using (go env)?

amd64
windows 10

What did you do?

Importing some(?) packages seems to confuse link.exe
In my "projectname/controllers/users.go" file, i am trying to import the package "github.com/gorilla/mux".

Doing so results in this error:

# command-line-arguments
C:\Go\pkg\tool\windows_amd64\link.exe: cannot open file C:\Go\pkg\windows_amd64/github.com/gorilla/mux.a: open C:\Go\pkg\windows_amd64/github.com/gorilla/mux.a: The system cannot find the path specified.

but my GOPATH variable is set to D:\Dev\Go\Projects. When I change the mux package to an invalid path, I get this error (as expected)

controllers\users.go:6:2: cannot find package "github.com/gorilla/mux_err" in any of:
C:\Go\src\github.com\gorilla\mux_err (from $GOROOT)
D:\Dev\Go\Projects\src\github.com\gorilla\mux_err (from $GOPATH)

But it is looking in the correct path now.

What did you expect to see?

linker.exe looking in the correct directory for the package.

What did you see instead?

linker.exe only looking in the GOROOT path.

This does not happen in the main package.

@TuralAsgar
Copy link

How did you solve this issue?

@mikioh mikioh changed the title linker.exe not looking in GOPATH for some packages cmd/go: linker.exe not looking in GOPATH for some packages Jul 21, 2017
@pigeonhands
Copy link
Author

Make sure you are using the full path when importing packages (e.g. github.com/BahNahNah/MyProject/controllers)

I cant remember exactly what I was doing to cause this error but it was something to do with the way I was importing my controllers package.

@dzdx
Copy link

dzdx commented Dec 22, 2017

I reslove the problem by remove all file in $GOPATH/pkg. The cause of this problem is that I upgraded golang

@KromDaniel
Copy link

KromDaniel commented Jan 7, 2018

I reslove the problem by remove all file in $GOPATH/pkg. The cause of this problem is that I upgraded golang

I'm a programmer 5 years, I never had this huge nightmare with new language as I have with GO.
it just doesn't work.
I have to delete $GOPATH/pkg before EVERY compile or I get linker error, no body knows why

go version go1.9.2 darwin/amd64

For some reason the compiler just ignores the GOPATH
I have this:

GOROOT=/usr/local/go #gosetup
GOPATH=/Users/danielkrom/go #gosetup

and getting the rrror
/usr/local/go/pkg/tool/darwin_amd64/link: cannot open file /usr/local/go/pkg/darwin_amd64/gopkg.in/mgo.v2.a: open /usr/local/go/pkg/darwin_amd64/gopkg.in/mgo.v2.a: no such file or directory

Why it tries /usr/local/go and not $GOPATH?

@davecheney
Copy link
Contributor

@KromDaniel this issue was closed several years ago. I suggest you open a new issue or ask for help using one of the support forums. Please see https://golang.org/wiki/Questions for good places to ask questions.

@golang golang locked as resolved and limited conversation to collaborators Jan 7, 2018
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

5 participants