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

dep ensure -add does not recursively introduce sub-dependencies from projects that do not vendor their imports #1817

Closed
marcusljx opened this issue Apr 18, 2018 · 6 comments

Comments

Projects
None yet
2 participants
@marcusljx
Copy link

commented Apr 18, 2018

What version of dep are you using (dep version)?

dep:
 version     : v0.4.1
 build date  : 2018-01-27
 git hash    : 37d9ea0
 go version  : go1.9.3
 go compiler : gc
 platform    : darwin/amd64

What dep command did you run?

dep ensure -add google.golang.org/grpc

What did you expect to see?

imports from within google.golang.org/grpc also vendored.
vendor dir should have both:

  • google.golang.org/grpc
  • github.com/golang/protobuf/proto (imported by google.golang.org/grpc/encoding/proto/proto.go)

What did you see instead?

only google.golang.org/grpc was vendored (sub-dependencies were not introduced).

@mattayes

This comment has been minimized.

Copy link
Contributor

commented Apr 20, 2018

@marcusljx What kind of [prune] settings are you using in your Gopkg.toml? Setting unused-packages = True would exclude github.com/golang/protobuf/proto if you aren't using the google.golang.org/grpc/encoding/proto package (directly or indirectly).

@marcusljx

This comment has been minimized.

Copy link
Author

commented Apr 20, 2018

@mattayes github.com/golang/protobuf/proto is in use by google.golang.org/grpc/encoding/proto, which is in use by my project.

For context, my prune settings is

[prune]
  go-tests = true
  unused-packages = true
@mattayes

This comment has been minimized.

Copy link
Contributor

commented Apr 21, 2018

@marcusljx I think I've realized what the issue is: google.golang.org/grpc and google.golang.org/grpc/encoding/proto are two different packages. Only the latter package has a dependency on github.com/golang/protobuf/proto, which is why you're not seeing it after you run dep ensure -add google.golang.org/grpc. Runing dep ensure -add google.com/golang.org/grpc/encoding/proto dep ensure -add google.golang.org/grpc/encoding/proto adds github.com/golang/protobuf/proto to vendor/, as expected.

You can find more information on this in the Daily Dep guide.

@marcusljx

This comment has been minimized.

Copy link
Author

commented Apr 22, 2018

Many thanks @mattayes! Seems like that does the trick (although the path should be: google/golang.org...., without .com at the googl).

I found a separate solution by refactoring my code to also imports github.com/golang/protobuf/proto, which makes it a direct dependency now.

@mattayes

This comment has been minimized.

Copy link
Contributor

commented Apr 22, 2018

@marcusljx Good catch! If that answers your question can you close this issue?

@marcusljx

This comment has been minimized.

Copy link
Author

commented Apr 22, 2018

Okay. Thanks once again!

For those who may be here because you're encountering this same issue, the TL;DR solution is to directly introduce the inner package that is importing the sub-dependency

dep ensure -add google.golang.org/grpc/encoding/proto

@marcusljx marcusljx closed this Apr 22, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.