Nick Charney Kaye
Nick Charney Kaye

Reputation: 4340

Why isn't Go 1.6.2 searching vendor/ for packages?

The structure of the project is:

.
├── glide.yaml
├── glide.lock
├── bin
├── pkg
├── src
└── vendor

I'm using Glide for dependency management, and the GOPATH is the location of my project root (absolute path resolving to . in the above tree.)

Glide appears to install dependencies correctly, however when attempting to run tests with Go 1.6.2, I don't see it even looking in the vendor/ folder before failing:

GOPATH=/home/charney/myproject go test -i ...
src/myapp/main.go:36:2: cannot find package "golang.org/x/net/context" in any of:
    /usr/local/go/src/golang.org/x/net/context (from $GOROOT)
    /home/charneymyproject/src/golang.org/x/net/context (from $GOPATH)

The package it is looking for is located at /home/charneymyproject/vendor/golang.org/x/net/context

Upvotes: 0

Views: 846

Answers (1)

Nick Charney Kaye
Nick Charney Kaye

Reputation: 4340

This is fixed by moving the vendor/ folder to inside of the src/ folder, like:

.
├── glide.yaml
├── glide.lock
├── bin
├── pkg
└── src
     └── vendor

Upvotes: 2

Related Questions