jayunit100
jayunit100

Reputation: 17648

How should a glide project import another project with a vendor/ directory?

The golang Glide packager automatically will install dependencies for a project, however, in doing so it pulls in dependencies from the vendor/, since many projects check in vendor dependencies.

How should one import a glide dependency which includes a vendor/ directory?

As of now, it appears that you can get errors such as :

./scheduler.go:36: cannot use "github.com/jayunit100/my-project/vendor/github.com/spf13/pflag".CommandLine (type *"github.com/jayunit100/my-project/vendor/a/b/spf13/pflag".FlagSet) as type *"github.com/jayunit100/my-project/vendor/a/b/vendor/github.com/spf13/pflag".FlagSet

Upvotes: 0

Views: 328

Answers (2)

jayunit100
jayunit100

Reputation: 17648

My current solution has been to manually delete vendor/ directories from libraries which are brought in that keep vendor/.

... (Update) glide supports a --strip-vendor option.

Upvotes: 0

squiguy
squiguy

Reputation: 33370

I think this is quite a common issue for people using glide. My team ran into the same issue and had to investigate for a while but eventually found that using the flatten operation solved this for us.

To do this pass the -v flag to your glide operations.

e.g. glide up -v

You can read more about it on the glide docs.

Upvotes: 2

Related Questions