wire icon indicating copy to clipboard operation
wire copied to clipboard

wire: add "prune" command

Open zombiezen opened this issue 7 years ago • 0 comments

Since Wire knows the minimal set of provider functions and wire.Value expressions it needs to generate the injector, we could introduce a command that trims out any provider sets from a wire.Use statement that aren't fully used and replaces them with exactly the elements that do get fully used. There could also be a more aggressive option that inlines all the provider functions and wire.Value expressions that are needed, to make it so that the injector template's imports map 1:1 with the generated code.

This would require similar logic to #51, but the usage is different. A subtract command is used for overriding providers, but a prune command is used for tightening dependencies.

h/t @neild for the idea.

zombiezen avatar Jul 03 '18 16:07 zombiezen