Glide: Using flatten flag

Created on 18 May 2016  ยท  5Comments  ยท  Source: Masterminds/glide

I am confused about the usage of flatten flag with glide.yaml. To flatten nested dependencies in vendor directory, are we supposed to add any such flag or is it included by default(release 0.7.0)?

I am using kubernetes and glog in my project and since glog is also present in vendor directory of kubernetes, there is a panic happening. With my understanding of glide up it should fetch only one copy of glog in my project's vendor directory and there should not be any copy in kubernetes vendor directory. Is it correct to assume that?

Most helpful comment

@mattfarina I'm facing the same issue here. Has support for flatten been removed? I can't see it in the documentation as well.

All 5 comments

There were some issues with this in the past. Can you update to Glide 0.10.2 and try again?

I am using glide version 0.10.2 and also tried to put flatten: true at top level package. Glide fetched glog in two locations.

Can you share your glide.yaml file and projects directory structure? It would make it easier for me to figure out what's going on.

This is how my dir structure looks like

tree -L 1
.
โ”œโ”€โ”€ alertconfig
โ”œโ”€โ”€ am
โ”œโ”€โ”€ configserver
โ”œโ”€โ”€ glide.lock
โ”œโ”€โ”€ glide.yaml
โ”œโ”€โ”€ healthwatcher
โ”œโ”€โ”€ promeconfig
โ”œโ”€โ”€ test
โ”œโ”€โ”€ tm-sidekick
โ””โ”€โ”€ vendor

and glide.yaml is

package: .
flatten: true
import:
- package: github.com/coreos/etcd
  subpackages:
  - client
- package: github.com/golang/glog
- package: github.com/golang/mock
  subpackages:
  - gomock
- package: github.com/google/gofuzz
- package: github.com/gorilla/handlers
- package: github.com/gorilla/mux
- package: github.com/onsi/ginkgo
  subpackages:
  - config
- package: github.com/onsi/gomega
- package: github.com/spf13/cobra
- package: github.com/spf13/pflag
- package: github.com/spf13/viper
- package: github.com/taviti/caldav-go
  subpackages:
  - webdav
  - webdav/entities
- package: golang.org/x/net
  subpackages:
  - context
- package: gopkg.in/inf.v0
- package: gopkg.in/validator.v2
- package: k8s.io/kubernetes

Vendor dir struct

 tree -L 3
.
โ”œโ”€โ”€ github.com
โ”‚ย ย  โ”œโ”€โ”€ BurntSushi
โ”‚ย ย  โ”‚ย ย  โ””โ”€โ”€ toml
โ”‚ย ย  โ”œโ”€โ”€ coreos
โ”‚ย ย  โ”‚ย ย  โ””โ”€โ”€ etcd
โ”‚ย ย  โ”œโ”€โ”€ golang
โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ glog
โ”‚ย ย  โ”‚ย ย  โ””โ”€โ”€ mock
โ”‚ย ย  โ”œโ”€โ”€ onsi
โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ ginkgo
โ”‚ย ย  โ”‚ย ย  โ””โ”€โ”€ gomega
...
โ””โ”€โ”€ k8s.io
    โ””โ”€โ”€ kubernetes
        โ”œโ”€โ”€ api
        โ”œโ”€โ”€ vendor
        โ””โ”€โ”€ www

and kubernetes vendor dir struct

vendor/k8s.io/kubernetes/vendor$ tree -L 3
.
โ”œโ”€โ”€ bitbucket.org
โ”‚ย ย  โ”œโ”€โ”€ bertimus9
โ”‚ย ย  โ”‚ย ย  โ””โ”€โ”€ systemstat
โ”‚ย ย  โ””โ”€โ”€ ww
โ”‚ย ย      โ””โ”€โ”€ goautoneg
โ”œโ”€โ”€ github.com
โ”‚ย ย  โ”œโ”€โ”€ coreos
โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ etcd
โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ go-etcd
โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ go-oidc
โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ go-semver
โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ go-systemd
โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ pkg
โ”‚ย ย  โ”‚ย ย  โ””โ”€โ”€ rkt
โ”‚ย ย  โ”œโ”€โ”€ golang
โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ glog
โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ groupcache
โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ mock
โ”‚ย ย  โ”‚ย ย  โ””โ”€โ”€ protobuf


(removed a bunch of entries for readability)

@mattfarina I'm facing the same issue here. Has support for flatten been removed? I can't see it in the documentation as well.

Was this page helpful?
0 / 5 - 0 ratings