@@ -21,43 +21,13 @@ import (
2121 "strings"
2222 "sync"
2323
24- "github.com/anchore/packageurl-go"
25- "github.com/gookit/color"
2624 "github.com/jedib0t/go-pretty/v6/table"
2725 "github.com/jedib0t/go-pretty/v6/text"
2826
2927 "github.com/docker/cli/cli/command"
3028 "github.com/docker/index-cli-plugin/types"
3129)
3230
33- type colors struct {
34- critical color.RGBColor
35- high color.RGBColor
36- medium color.RGBColor
37- low color.RGBColor
38- unspecified color.RGBColor
39-
40- removed color.Color
41- added color.Color
42- changed color.Color
43- }
44-
45- var defaultColors * colors
46-
47- func init () {
48- defaultColors = & colors {
49- critical : color .HEX ("D52536" ),
50- high : color .HEX ("DD7805" ),
51- medium : color .HEX ("FBB552" ),
52- low : color .HEX ("FCE1A9" ),
53- unspecified : color .HEX ("E9ECEF" ),
54-
55- removed : color .Green ,
56- added : color .Red ,
57- changed : color .Yellow ,
58- }
59- }
60-
6131func DiffImages (image1 string , image2 string , cli command.Cli , workspace string , apikey string ) error {
6232 resultChan := make (chan ImageIndexResult , 2 )
6333 var wg sync.WaitGroup
@@ -90,14 +60,6 @@ func toPackageKey(pkg types.Package) string {
9060 }
9161}
9262
93- func toPackageName (pkg packageurl.PackageURL ) string {
94- if pkg .Namespace != "" {
95- return fmt .Sprintf ("%s/%s/%s" , pkg .Type , pkg .Namespace , pkg .Name )
96- } else {
97- return fmt .Sprintf ("%s/%s" , pkg .Type , pkg .Name )
98- }
99- }
100-
10163func toImageName (result ImageIndexResult ) string {
10264 imageName := result .Sbom .Source .Image .Name
10365 imageName = strings .TrimPrefix (imageName , "index.docker.io/" )
@@ -223,14 +185,14 @@ func diffPackages(result1, result2 ImageIndexResult) {
223185 }
224186}
225187
226- type CveEntry struct {
188+ /* type CveEntry struct {
227189 image1 []types.Cve
228190 image2 []types.Cve
229191}
230192
231193type CveMap map[string]CveEntry
232194
233- /* func diffCves(result1, result2 ImageIndexResult) {
195+ func diffCves(result1, result2 ImageIndexResult) {
234196 dc := 0
235197 cves := make(CveMap)
236198 for _, c := range result1.Sbom.Vulnerabilities {
0 commit comments