Glide: go run command fails to load the packages from vendor folder

Created on 26 Nov 2015  路  2Comments  路  Source: Masterminds/glide

Here is my glide.yaml:

package: main
import:
- package: golang.org/x/net
- package: github.com/yhat/scrape
- package: github.com/fatih/color

Additional information:

$ go version
go version go1.5.1 darwin/amd64

$ go env
OARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/umayr/.go"
GORACE=""
GOROOT="/usr/local/Cellar/go/1.5.1/libexec"
GOTOOLDIR="/usr/local/Cellar/go/1.5.1/libexec/pkg/tool/darwin_amd64"
GO15VENDOREXPERIMENT="1"
CC="clang"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fno-common"
CXX="clang++"
CGO_ENABLED="1"

Glide installs all the dependencies in the vendor/ folder correctly, but then when I try to go run <filename>, it fails to load the packages.

$ go run example.go
example.go:5:2: cannot find package "github.com/fatih/color" in any of:
    /usr/local/Cellar/go/1.5.1/libexec/src/github.com/fatih/color (from $GOROOT)
    /Users/umayr/.go/src/github.com/fatih/color (from $GOPATH)
example.go:6:2: cannot find package "github.com/yhat/scrape" in any of:
    /usr/local/Cellar/go/1.5.1/libexec/src/github.com/yhat/scrape (from $GOROOT)
    /Users/umayr/.go/src/github.com/yhat/scrape (from $GOPATH)
example.go:7:2: cannot find package "golang.org/x/net/html" in any of:
    /usr/local/Cellar/go/1.5.1/libexec/src/golang.org/x/net/html (from $GOROOT)
    /Users/umayr/.go/src/golang.org/x/net/html (from $GOPATH)
example.go:8:2: cannot find package "golang.org/x/net/html/atom" in any of:
    /usr/local/Cellar/go/1.5.1/libexec/src/golang.org/x/net/html/atom (from $GOROOT)
    /Users/umayr/.go/src/golang.org/x/net/html/atom (from $GOPATH)

Is there anything I'm missing here?

Most helpful comment

In order to make GO15VENDOREXPERIMENT flag work, project should be placed in ${GOPATH}/src.

Closing this since its not a valid glide issue, my bad.

All 2 comments

In order to make GO15VENDOREXPERIMENT flag work, project should be placed in ${GOPATH}/src.

Closing this since its not a valid glide issue, my bad.

@umayr the go tool requires code be in the GOPATH. If you look at the go source you'll see it's required. This is a byproduct of the way Google organizes their code. We used to try and do project based with the go tool but ran into lots of issues.

Was this page helpful?
0 / 5 - 0 ratings