From 49570cf783033135dde52c3001f6eafee1446792 Mon Sep 17 00:00:00 2001 From: allencloud Date: Thu, 2 Feb 2017 04:03:58 +0800 Subject: [PATCH] do not fail fast when executing inspect command Signed-off-by: allencloud --- command/inspect/inspector.go | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/command/inspect/inspector.go b/command/inspect/inspector.go index 1e53671f84..a899da065b 100644 --- a/command/inspect/inspector.go +++ b/command/inspect/inspector.go @@ -5,6 +5,7 @@ import ( "encoding/json" "fmt" "io" + "strings" "text/template" "github.com/Sirupsen/logrus" @@ -60,17 +61,16 @@ func Inspect(out io.Writer, references []string, tmplStr string, getRef GetRefFu return cli.StatusError{StatusCode: 64, Status: err.Error()} } - var inspectErr error + var inspectErrs []string for _, ref := range references { element, raw, err := getRef(ref) if err != nil { - inspectErr = err - break + inspectErrs = append(inspectErrs, err.Error()) + continue } if err := inspector.Inspect(element, raw); err != nil { - inspectErr = err - break + inspectErrs = append(inspectErrs, err.Error()) } } @@ -78,8 +78,11 @@ func Inspect(out io.Writer, references []string, tmplStr string, getRef GetRefFu logrus.Errorf("%s\n", err) } - if inspectErr != nil { - return cli.StatusError{StatusCode: 1, Status: inspectErr.Error()} + if len(inspectErrs) != 0 { + return cli.StatusError{ + StatusCode: 1, + Status: strings.Join(inspectErrs, "\n"), + } } return nil }