glide-vc icon indicating copy to clipboard operation
glide-vc copied to clipboard

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

Open ericchiang opened this issue 8 years ago • 3 comments

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

ericchiang avatar Dec 21 '16 20:12 ericchiang

@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 https://github.com/sgotti/glide-vc/pull/21#issuecomment-246097454), 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 avatar Dec 21 '16 20:12 sgotti

@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.

sgotti avatar Dec 21 '16 20:12 sgotti

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.

ericchiang avatar Dec 21 '16 21:12 ericchiang