Skip to content

Commit

Permalink
Revert: gost/Ubuntu.ConvertToModel() is public method now (#1597)
Browse files Browse the repository at this point in the history
  • Loading branch information
kl-sinclair authored Feb 8, 2023
1 parent 1927ed3 commit 7044929
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions gost/ubuntu.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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=") {
Expand Down
2 changes: 1 addition & 1 deletion gost/ubuntu_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
})
Expand Down

0 comments on commit 7044929

Please sign in to comment.