From fb71baf557c1eb06ddd77ee832c927e488dc34a2 Mon Sep 17 00:00:00 2001 From: Zack Mullaly Date: Wed, 11 Jul 2018 15:53:14 -0400 Subject: [PATCH] Fixed the error field in shortVulnResponse --- scribevulnpolicy/client.go | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/scribevulnpolicy/client.go b/scribevulnpolicy/client.go index 60dfef2..b66d1c1 100644 --- a/scribevulnpolicy/client.go +++ b/scribevulnpolicy/client.go @@ -20,12 +20,17 @@ const ( 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 // list of vulnerabilities for a namespace. type shortVulnResponse struct { - Vulns []shortVuln `json:"Vulnerabilities"` - Error *string `json:"Error"` - NextPage string `json:"NextPage"` + Vulns []shortVuln `json:"Vulnerabilities"` + Error *errorMessage `json:"Error"` + NextPage string `json:"NextPage"` } // 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 { - return []shortVuln{}, errors.New(*respData.Error) + return []shortVuln{}, errors.New(respData.Error.Message) } if respData.NextPage == "" {