Fixed the error field in shortVulnResponse

This commit is contained in:
Zack Mullaly 2018-07-11 15:53:14 -04:00
Родитель 7b7ef711bd
Коммит fb71baf557
1 изменённых файлов: 9 добавлений и 4 удалений

Просмотреть файл

@ -20,12 +20,17 @@ const (
clairGetVulnsEndptFmt string = "http://127.0.0.1:6060/v1/namespaces/%s/vulnerabilities/%s?fixedIn" clairGetVulnsEndptFmt string = "http://127.0.0.1:6060/v1/namespaces/%s/vulnerabilities/%s?fixedIn"
) )
// errorMessage contains error data that the Clair API may return.
type errorMessage struct {
Message string `json:"Message"`
}
// shortVulnResponse contains the response data we expect from a request for a // shortVulnResponse contains the response data we expect from a request for a
// list of vulnerabilities for a namespace. // list of vulnerabilities for a namespace.
type shortVulnResponse struct { type shortVulnResponse struct {
Vulns []shortVuln `json:"Vulnerabilities"` Vulns []shortVuln `json:"Vulnerabilities"`
Error *string `json:"Error"` Error *errorMessage `json:"Error"`
NextPage string `json:"NextPage"` NextPage string `json:"NextPage"`
} }
// longVulnResponse contains response data we expect from a request for more // longVulnResponse contains response data we expect from a request for more
@ -83,7 +88,7 @@ func listVulnsForNamespace(namespace string) ([]shortVuln, error) {
} }
if respData.Error != nil { if respData.Error != nil {
return []shortVuln{}, errors.New(*respData.Error) return []shortVuln{}, errors.New(respData.Error.Message)
} }
if respData.NextPage == "" { if respData.NextPage == "" {