From 704492963c5dc75cc6131dca23a02aa405673dd5 Mon Sep 17 00:00:00 2001 From: Sinclair Date: Wed, 8 Feb 2023 11:36:36 +0900 Subject: [PATCH] Revert: gost/Ubuntu.ConvertToModel() is public method now (#1597) --- gost/ubuntu.go | 5 +++-- gost/ubuntu_test.go | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/gost/ubuntu.go b/gost/ubuntu.go index 4f3965e969..85f22350ec 100644 --- a/gost/ubuntu.go +++ b/gost/ubuntu.go @@ -233,7 +233,7 @@ func detect(cves map[string]gostmodels.UbuntuCVE, fixed bool, srcPkg models.SrcP var contents []cveContent for _, cve := range cves { c := cveContent{ - cveContent: *convertToModel(&cve), + cveContent: *(Ubuntu{}).ConvertToModel(&cve), } if fixed { @@ -296,7 +296,8 @@ func detect(cves map[string]gostmodels.UbuntuCVE, fixed bool, srcPkg models.SrcP return contents } -func convertToModel(cve *gostmodels.UbuntuCVE) *models.CveContent { +// ConvertToModel converts gost model to vuls model +func (ubu Ubuntu) ConvertToModel(cve *gostmodels.UbuntuCVE) *models.CveContent { references := []models.Reference{} for _, r := range cve.References { if strings.Contains(r.Reference, "https://cve.mitre.org/cgi-bin/cvename.cgi?name=") { diff --git a/gost/ubuntu_test.go b/gost/ubuntu_test.go index 3aa4905a84..a0e455a3b0 100644 --- a/gost/ubuntu_test.go +++ b/gost/ubuntu_test.go @@ -127,7 +127,7 @@ func TestUbuntuConvertToModel(t *testing.T) { } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - if got := convertToModel(&tt.input); !reflect.DeepEqual(got, &tt.expected) { + if got := (Ubuntu{}).ConvertToModel(&tt.input); !reflect.DeepEqual(got, &tt.expected) { t.Errorf("Ubuntu.ConvertToModel() = %#v, want %#v", got, &tt.expected) } })