Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't remove main packages explicitly declared in glide.yaml #27

Open
ericchiang opened this issue Dec 21, 2016 · 3 comments
Open

Don't remove main packages explicitly declared in glide.yaml #27

ericchiang opened this issue Dec 21, 2016 · 3 comments

Comments

@ericchiang
Copy link
Contributor

Issue:

Projects sometime vendor main packages no directly imported by any code in the project. For example one of my projects vendors a go protoc plugin[0].

However, because these aren't imported directly, glide-vc removes them from the vendor directory,

Proposal:

If mains are explicitly declared as packages or sub packages, include them when determining if a package is imported.

[0] https://github.com/coreos/dex/blob/3c9ab50ddf05b07b74cda1777df6addf9ff44dfe/glide.yaml#L125

@sgotti
Copy link
Owner

sgotti commented Dec 21, 2016

@ericchiang I think this is the same thing that i tried to explain in the README

In #21 glide-vc moved from using the glide.lock to the glide list output to determine required packages. A solution will be to use the previous logic passing --use-lock-file.

Another solution will be to use a dummy go file that underscore imports the packages so they will be detected as needed also if no code is used (see #21 (comment)), also rkt, in the past, used a dummy.go to keep vendored CNI plugins.

There are also some subtle cases like #18 where I can't see an easy solution without revendoring them after running glide-vc.

@sgotti
Copy link
Owner

sgotti commented Dec 21, 2016

@ericchiang But probably, as you proposed, an additional flag that will also keep packages explicitly defined in glide.yaml (instead of all the packages listed in the generated glide.lock) could be a good mid way solution.

@ericchiang
Copy link
Contributor Author

Ah thanks. I think the --use-lock-file works for us for now!

We've used a dummy go file in the past but it's a pain to have a file that doesn't compile when we use go list ./... a lot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants