Glide: go build failed

Created on 17 Jan 2016  ยท  7Comments  ยท  Source: Masterminds/glide

โฏ go build
main.go:3:8: cannot find package "github.com/fatih/color" in any of:
        /usr/local/Cellar/go/1.5.2/libexec/src/github.com/fatih/color (from $GOROOT)
        /Users/akagi201/akgo/src/github.com/fatih/color (from $GOPATH)

my source code is here: https://github.com/Akagi201/go15vendor-hello

It seems that go build doesn't go to vender directory to find the deps. Why? Help needed!

awaiting feedback

All 7 comments

Did you forget to do export GO15VENDOREXPERIMENT=1?

@Akagi201 Prior to Go 1.6 you need to set GO15VENDOREXPERIMENT=1 for the go tool to pick up things in vendor/ folders. Once Go 1.6 is out that will be on by default.

We ask about this because you'd have a 3rd search path listed with the vendor/ folder if that were enabled.

There is a big issue with detecting vendor directory by golang I run into multiple times. Usually my project is in a directory like ~/projects/awesomeproject and under $GOPATH/src/github.com/arvenil/ I've always had simlink pointing out to ~/projects/awesomeproject. This worked well but doesn't work with the vendor directory.

If I cd to ~/projects/awesomeproject it doesn't work and vendor search path is not mentioned. If I cd to $GOPATH/src/github.com/arvenil/ it works - correctly looks for vendor dir.

Maybe this is an issue @Akagi201 was experiencing.

Because of that and problems because of the configuration CircleCI I also wonder if there is a way to force/ask glide to install deps under $GOPATH instead of vendor dir - I can create separate issue for that.

As a general rule, the go tool requires your code to be in the GOPATH. Some things don't work right when outside that or symlinked in.

Personally, I find this rather frustrating.

Yes, I understand that, but having a simlink always worked for me in the past... however not with vendor dir, and the worst thing is you are in the project dir, you can see vendor dir with ls yet go tools don't pick it up and you have no idea why. Really bad user experience :) Anyway now I know I need to cd $GOPATH/src/github.com/vendor/project, so I'm fine :)

Is this happening in the go tool specifically? If so you might want to file an issue with Go.

Is there anything left here that Glide needs to resolve?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

gitwangjian picture gitwangjian  ยท  6Comments

diwakergupta picture diwakergupta  ยท  6Comments

gm42 picture gm42  ยท  6Comments

jaxxstorm picture jaxxstorm  ยท  3Comments

mh-cbon picture mh-cbon  ยท  3Comments