This repository has been archived by the owner on Sep 9, 2020. It is now read-only.
This repository has been archived by the owner on Sep 9, 2020. It is now read-only.
Absorb prune into ensure #944
Closed
Description
dep prune
currently exists as a separate command. This is not optimal; we want to incorporate its behavior into dep ensure
directly, obviating the need to run the extra command.
Projects relying on pruning will necessarily have to give up on (fast) vendor/
verification - #121, as that verification will need to rely on a hash of each dependency project's entire tree, prior to pruning. That's just going to be a cost of doing business.
This will involve a few things:
- Create a set of flags (express as a bitset, e.g.
type PruneOptions uint8
) in gps representing the orthogonal, combinable pruning modes:
i. Remove*_test.go
files
ii. Remove non-go files (except LICENSE, COPYING)
iii. Remove unused packages
iv. Remove nestedvendor
dirs (note that gps needs to have this as a flag, but dep unconditionally sets it - we do not give the user the option to NOT strip vendor directories) - Introduce a new top-level section in
Gopkg.toml
that allows the user to specify each of these separately. I'm imagining something like this:(All default to false)[prune] non-go = true test-go = true unused-packages = true
- Modify
gps.WriteDepTree()
to take a struct with aPruneOptions
bitfield. (Keep an eye on [WIP] Parallelised gps.WriteDepTree #903, this overlaps with that) - Hack up the logic currently in
cmd/dep/prune.go
, moving it over into unexported functions in gps thatgps.WriteDepTree()
calls into itself to perform the pruning.
#120 is absurdly long and less relevant now, so I'm going to close it in favor of this.
- Remember to update the README when we're done with this!
Activity