Skip to content
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
Closed
@sdboyer

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:

  1. 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 nested vendor 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)
  2. 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:
    [prune]
      non-go = true
      test-go = true
      unused-packages = true
    (All default to false)
  3. Modify gps.WriteDepTree() to take a struct with a PruneOptions bitfield. (Keep an eye on [WIP] Parallelised gps.WriteDepTree #903, this overlaps with that)
  4. Hack up the logic currently in cmd/dep/prune.go, moving it over into unexported functions in gps that gps.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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions