This PR simplifies the cache initialization process in the artifact scanning. Previously, we initialized the cache.Cache instance within pkg/commands/artifact/run.go to support --clear-cache and --reset operations. However, these operations have been moved to the trivy clean command.
With this change, we can now generate the cache.Cache instance through google/wire, which is consistent with other instances in the project.
Changes
Remove the initCache function from pkg/commands/artifact/run.go
Update the wire injection to include cache.Cache generation
Adjust the artifact scanning initialization process to use the wire-generated cache instance
Benefits
Improved consistency in scanner initialization across the project
Simplified code structure in the artifact scanning module
Better alignment with the project's dependency injection pattern using wire
Description
This PR simplifies the cache initialization process in the artifact scanning. Previously, we initialized the
cache.Cache
instance withinpkg/commands/artifact/run.go
to support--clear-cache
and--reset
operations. However, these operations have been moved to thetrivy clean
command.With this change, we can now generate the
cache.Cache
instance through google/wire, which is consistent with other instances in the project.Changes
initCache
function frompkg/commands/artifact/run.go
cache.Cache
generationBenefits
Checklist