{"action":"created","issue":{"url":"https://api.github.com/repos/Masterminds/glide/issues/70","labels_url":"https://api.github.com/repos/Masterminds/glide/issues/70/labels{/name}","comments_url":"https://api.github.com/repos/Masterminds/glide/issues/70/comments","events_url":"https://api.github.com/repos/Masterminds/glide/issues/70/events","html_url":"https://github.com/Masterminds/glide/pull/70","id":103905514,"number":70,"title":"Add flatten open to imports","user":{"login":"interlock","id":118081,"avatar_url":"https://avatars.githubusercontent.com/u/118081?v=3","gravatar_id":"","url":"https://api.github.com/users/interlock","html_url":"https://github.com/interlock","followers_url":"https://api.github.com/users/interlock/followers","following_url":"https://api.github.com/users/interlock/following{/other_user}","gists_url":"https://api.github.com/users/interlock/gists{/gist_id}","starred_url":"https://api.github.com/users/interlock/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/interlock/subscriptions","organizations_url":"https://api.github.com/users/interlock/orgs","repos_url":"https://api.github.com/users/interlock/repos","events_url":"https://api.github.com/users/interlock/events{/privacy}","received_events_url":"https://api.github.com/users/interlock/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":15,"created_at":"2015-08-30T07:15:04Z","updated_at":"2015-09-02T03:44:55Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/Masterminds/glide/pulls/70","html_url":"https://github.com/Masterminds/glide/pull/70","diff_url":"https://github.com/Masterminds/glide/pull/70.diff","patch_url":"https://github.com/Masterminds/glide/pull/70.patch"},"body":"This is a prototype of #55 \r\n\r\nIt adds a `flatten` option that takes `true` or `false` as an option.\r\n\r\nWhen set to `true`, any sub package vendored in with the same name will be skipped.\r\nWhen set to `false`, business as usual.\r\n\r\nA few other changes of note:\r\n- []*Dependency was made into a type Dependencies so I could put common `Get` by name functionality on it. There may be code elsewhere that can use this.\r\n* Added `boolOrDefault` to work with the yaml and having a default bool set\r\n* Added the concept of a Config.Parent and some funs related to it traversing up the tree.\r\n* Enhanced some of the yaml tests for new and existing functionality."},"comment":{"url":"https://api.github.com/repos/Masterminds/glide/issues/comments/136928254","html_url":"https://github.com/Masterminds/glide/pull/70#issuecomment-136928254","issue_url":"https://api.github.com/repos/Masterminds/glide/issues/70","id":136928254,"user":{"login":"hilyjiang","id":1214867,"avatar_url":"https://avatars.githubusercontent.com/u/1214867?v=3","gravatar_id":"","url":"https://api.github.com/users/hilyjiang","html_url":"https://github.com/hilyjiang","followers_url":"https://api.github.com/users/hilyjiang/followers","following_url":"https://api.github.com/users/hilyjiang/following{/other_user}","gists_url":"https://api.github.com/users/hilyjiang/gists{/gist_id}","starred_url":"https://api.github.com/users/hilyjiang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hilyjiang/subscriptions","organizations_url":"https://api.github.com/users/hilyjiang/orgs","repos_url":"https://api.github.com/users/hilyjiang/repos","events_url":"https://api.github.com/users/hilyjiang/events{/privacy}","received_events_url":"https://api.github.com/users/hilyjiang/received_events","type":"User","site_admin":false},"created_at":"2015-09-02T03:44:55Z","updated_at":"2015-09-02T03:44:55Z","body":"@interlock I have remove all old work copy and follow your installation.\r\n\r\nYou can see that `glide` already have flatten option.\r\n```\r\n# glide up --help | grep flatten\r\n        If the '--delete-flatten' flag is present, Glide will remove any depenedencies\r\n        markred flatten within dependencies.\r\n   --delete-flatten             Delete flattened vendor packages.\r\n```\r\n\r\nBut it still not work as my expect.\r\n\r\nThis is a minimal test project:\r\n - `c` depends on `a` and `b`\r\n - `b` depends on `a`\r\n\r\n```\r\n[root@localhost ~]# cd /root/godev/src/c/\r\n[root@localhost c]# cat glide.yaml \r\npackage: c\r\nflatten: true\r\nimport:\r\n  - package: a\r\n    repo: /git/a.git\r\n    vcs: git\r\n  - package: b\r\n    repo: /git/b.git\r\n    vcs: git\r\n[root@localhost c]# glide up\r\n[INFO] Fetching updates for a.\r\n[INFO] Fetching updates for b.\r\n[INFO] Checking dependencies for updates. Godeps: false, GPM: false\r\n[INFO] Inspecting /root/godev/src/c/vendor.\r\n[INFO] Looking in /root/godev/src/c/vendor/a for a glide.yaml file.\r\n[INFO] Package a manages its own dependencies.\r\n[INFO] Looking in /root/godev/src/c/vendor/b for a glide.yaml file.\r\n[INFO] Doing a glide in /root/godev/src/c/vendor/b\r\n[INFO] Skipping importing a due to flatten being set in root config glide.yaml\r\n[INFO] Inspecting /root/godev/src/c/vendor/b/vendor.\r\n[root@localhost c]# tree \r\n.\r\n├── glide.yaml\r\n├── main.go\r\n└── vendor\r\n    ├── a\r\n    │   └── a.go\r\n    └── b\r\n        ├── b.go\r\n        └── glide.yaml\r\n\r\n3 directories, 5 files\r\n```\r\n\r\nIt works!\r\n\r\nThen let's go ahead:\r\n - `d` depends on `c`\r\n - `c` depends on `a` and `b`\r\n - `b` depends on `a`\r\n\r\n```\r\n[root@localhost c]# cd ../d/\r\n[root@localhost d]# cat glide.yaml \r\npackage: d\r\nflatten: true\r\nimport:\r\n  - package: c\r\n    repo: /git/c.git\r\n    vcs: git\r\n[root@localhost d]# glide  up\r\n[INFO] Fetching updates for c.\r\n[INFO] Checking dependencies for updates. Godeps: false, GPM: false\r\n[INFO] Inspecting /root/godev/src/d/vendor.\r\n[INFO] Looking in /root/godev/src/d/vendor/c for a glide.yaml file.\r\n[INFO] Doing a glide in /root/godev/src/d/vendor/c\r\n[INFO] Importing a to project /root/godev/src/d/vendor/c\r\n[INFO] Importing b to project /root/godev/src/d/vendor/c\r\n[INFO] Inspecting /root/godev/src/d/vendor/c/vendor.\r\n[INFO] Looking in /root/godev/src/d/vendor/c/vendor/a for a glide.yaml file.\r\n[INFO] Package a manages its own dependencies.\r\n[INFO] Looking in /root/godev/src/d/vendor/c/vendor/b for a glide.yaml file.\r\n[INFO] Doing a glide in /root/godev/src/d/vendor/c/vendor/b\r\n[INFO] Importing a to project /root/godev/src/d/vendor/c/vendor/b\r\n[INFO] Inspecting /root/godev/src/d/vendor/c/vendor/b/vendor.\r\n[INFO] Looking in /root/godev/src/d/vendor/c/vendor/b/vendor/a for a glide.yaml file.\r\n[INFO] Package a manages its own dependencies.\r\n[root@localhost d]# tree \r\n.\r\n├── glide.yaml\r\n└── vendor\r\n    └── c\r\n        ├── c.go\r\n        ├── glide.yaml\r\n        └── vendor\r\n            ├── a\r\n            │   └── a.go\r\n            └── b\r\n                ├── b.go\r\n                ├── glide.yaml\r\n                └── vendor\r\n                    └── a\r\n                        └── a.go\r\n\r\n7 directories, 7 files\r\n```\r\n\r\nThere are still two copies of `a` in the vendor directory of `c`."}}