Skip to content
This repository was archived by the owner on Sep 9, 2020. It is now read-only.

dep does not seem to respect a project's packages setting in the Gopkg.lock file #874

Closed
jgeiger opened this issue Jul 21, 2017 · 2 comments

Comments

@jgeiger
Copy link
Contributor

jgeiger commented Jul 21, 2017

Creating a simple app with a testing dependency adds the entire project, not just the requested package.

I've created a simple repository with a use case:
https://github.com/jgeiger/dep_bug/tree/single_package_include

If you remove the 2nd commit and run

dep init
dep ensure

You see it includes all of onsi/gomega and not just onsi/gomega/format. It seems the lock file is also specifically showing only the format package.

Gopkg.lock

[[projects]]
  name = "github.com/onsi/gomega"
  packages = ["format"]
  revision = "c893efa28eb45626cdaa76c9f653b62488858837"
  version = "v1.2.0"

[solve-meta]
  analyzer-name = "dep"
  analyzer-version = 1
  inputs-digest = "5e0de845bb486cf6d10bd90820c209918c72ab17ca60b1824309f496393de40e"
  solver-name = "gps-cdcl"
  solver-version = 1

What version of Go (go version) and dep (git describe --tags) are you using?

go version
go version go1.8.3 linux/amd64

git describe --tags
v0.1.0-257-g12d69a9

What dep command did you run?

dep init
dep ensure

What did you expect to see?

It should only vendor the single package I've required and is listed in the Gopkg.lock file.

 create mode 100644 vendor/github.com/onsi/gomega/format/format.go
 create mode 100644 vendor/github.com/onsi/gomega/format/format_suite_test.go
 create mode 100644 vendor/github.com/onsi/gomega/format/format_test.go

What did you see instead?

All of github.com/onsi/gomega has been vendored when I commit via git.

 create mode 100644 vendor/github.com/onsi/gomega/.gitignore
 create mode 100644 vendor/github.com/onsi/gomega/.travis.yml
 create mode 100644 vendor/github.com/onsi/gomega/CHANGELOG.md
 create mode 100644 vendor/github.com/onsi/gomega/CONTRIBUTING.md
 create mode 100644 vendor/github.com/onsi/gomega/LICENSE
 create mode 100644 vendor/github.com/onsi/gomega/README.md
 create mode 100644 vendor/github.com/onsi/gomega/format/format.go
 create mode 100644 vendor/github.com/onsi/gomega/format/format_suite_test.go
 create mode 100644 vendor/github.com/onsi/gomega/format/format_test.go
 create mode 100644 vendor/github.com/onsi/gomega/gbytes/buffer.go
 create mode 100644 vendor/github.com/onsi/gomega/gbytes/buffer_test.go
 create mode 100644 vendor/github.com/onsi/gomega/gbytes/gbuffer_suite_test.go
 create mode 100644 vendor/github.com/onsi/gomega/gbytes/io_wrappers.go
 create mode 100644 vendor/github.com/onsi/gomega/gbytes/io_wrappers_test.go
 create mode 100644 vendor/github.com/onsi/gomega/gbytes/say_matcher.go
 create mode 100644 vendor/github.com/onsi/gomega/gbytes/say_matcher_test.go
...snipped...
@carolynvs
Copy link
Collaborator

If you want your vendor to only contain the sub-packages that you are currently using, run dep prune -v.

Prune is being reworked and will eventually move to the dep ensure command, but for now this the way to do it. 😀

@carolynvs
Copy link
Collaborator

Thanks for the feedback! I've #875 to track documenting how prune works today.

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

No branches or pull requests

2 participants