From 37716feac73bd1df1081e27e8ab5516320241b28 Mon Sep 17 00:00:00 2001 From: Kota Kanbe Date: Mon, 27 Apr 2020 17:02:27 +0900 Subject: [PATCH] refactor(lint): fix lint warnings (#967) --- config/config.go | 1 + contrib/owasp-dependency-check/parser/parser.go | 8 ++++---- cwe/sans.go | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/config/config.go b/config/config.go index 52fef860..bc790292 100644 --- a/config/config.go +++ b/config/config.go @@ -1099,6 +1099,7 @@ type Image struct { IgnoreCves []string `json:"ignoreCves,omitempty"` } +// GetFullName returns a full name of the image func (i *Image) GetFullName() string { if i.Digest != "" { return i.Name + "@" + i.Digest diff --git a/contrib/owasp-dependency-check/parser/parser.go b/contrib/owasp-dependency-check/parser/parser.go index 7525217b..e1aaab59 100644 --- a/contrib/owasp-dependency-check/parser/parser.go +++ b/contrib/owasp-dependency-check/parser/parser.go @@ -16,11 +16,11 @@ type analysis struct { } type dependency struct { - Identifiers []vulnerabilityId `xml:"identifiers>vulnerabilityIds"` + Identifiers []vulnerabilityID `xml:"identifiers>vulnerabilityIds"` } -type vulnerabilityId struct { - Id string `xml:"id"` +type vulnerabilityID struct { + ID string `xml:"id"` } func appendIfMissing(slice []string, str string) []string { @@ -55,7 +55,7 @@ func Parse(path string) ([]string, error) { cpes := []string{} for _, d := range anal.Dependencies { for _, ident := range d.Identifiers { - id := ident.Id // Start with cpe:2.3: + id := ident.ID // Start with cpe:2.3: // Convert from CPE 2.3 to CPE 2.2 if strings.HasPrefix(id, "cpe:2.3:") { wfn, err := naming.UnbindFS(id) diff --git a/cwe/sans.go b/cwe/sans.go index 083f1ae7..01bbfefd 100644 --- a/cwe/sans.go +++ b/cwe/sans.go @@ -29,5 +29,5 @@ var SansTopTwentyfive = map[string]string{ "759": "25", } -// SansTopTwentyfiveURL +// SansTopTwentyfiveURL is a URL of sans 25 var SansTopTwentyfiveURL = "https://www.sans.org/top25-software-errors/"