golang / dep

Go dependency management tool experiment (deprecated)
https://golang.github.io/dep/
BSD 3-Clause "New" or "Revised" License
12.85k stars 1.05k forks source link

Dep ensure -v does not vendor all pkgs of dependency which is not used yet. #1745

Closed prateeknayak closed 4 years ago

prateeknayak commented 6 years ago

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 -v

Warning: the following project(s) have [[constraint]] stanzas in Gopkg.toml:

  ✗  github.com/aws/aws-sdk-go

However, these projects are not direct dependencies of the current project:
they are not imported in any .go files, nor are they in the 'required' list in
Gopkg.toml. Dep only applies [[constraint]] rules to direct dependencies, **so
these rules will have no effect.**
Solver wall times by segment:
     b-source-exists: 39.995677362s
         b-list-pkgs:   2.88772274s
              b-gmal:  2.544714165s
  b-deduce-proj-root:  200.047971ms
             satisfy:    3.789906ms
         select-atom:    2.724068ms
            new-atom:    1.481117ms
         select-root:     430.644µs
               other:       72.96µs
            add-atom:      17.401µs

  TOTAL: 45.636678334s

(1/12) Wrote github.com/jtolds/gls@v4.2.1
(2/12) Wrote github.com/howeyc/gopass@master
(3/12) Wrote github.com/vaughan0/go-ini@master
(4/12) Wrote github.com/smartystreets/assertions@1.8.3
(5/12) Wrote gopkg.in/amz.v2@v2
(6/12) Wrote github.com/urfave/cli@v1.20.0
(7/12) Wrote github.com/libgit2/git2go@master
(9/12) Wrote github.com/gopherjs/gopherjs@master
(10/12) Wrote github.com/smartystreets/goconvey@1.6.3
(11/12) Wrote golang.org/x/sys@master
(12/12) Wrote golang.org/x/crypto@master

What did you expect to see?

I expect to see the aws-sdk-go with its aws pkg vendored in.

What did you see instead?

Unfortunately, all I see is the root of the aws-sdk-go project and not the aws pkg (which is what i really want). I understand, I may not be yet importing it in my code hence dep does not resolve it for me . But at this point I am not entirely sure what pkgs out of my dependecy I would use (sure I can read the documentation) but I want to use autocomplete, Intelisense features of my IDE. For that I would require all the pkgs ahead of time wouldn't I ?

carolynvs commented 6 years ago

Agreed! This is a poor user experience.

When I run into this, as a workaround I turn off the prune unused packages setting, and then pick any package with go-code in it and run dep ensure -add github.com/PROJECT/RANDO/PACKAGE.

I think that when we fix the ability to add a constraint for a package without go code, that will help. We should circle back and make sure that is enough once that's in.

mvdan commented 4 years ago

Dep was officially deprecated earlier this year, and the proposal to archive this repository was accepted. As such, I'm closing outstanding issues before archiving the repository. For any further comments, please use the proposal thread on the Go issue tracker. Thanks!