From 89c080f85a9a08f290d616bb71202c58e4f9c07b Mon Sep 17 00:00:00 2001 From: Pegleg Date: Thu, 7 Jun 2018 01:23:35 -0700 Subject: [PATCH] Bug fix --- main.go | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/main.go b/main.go index d336093..42342bf 100644 --- a/main.go +++ b/main.go @@ -98,7 +98,9 @@ func analyze(cli *client.Client, imageID string) { out, err := cli.ImagePull(context.Background(), imageID, types.ImagePullOptions{}) if err != nil { color.Red(err.Error()) - color.Yellow("Use the -sV flag to change your client version. ./WhaleTail -sV=1.36 %s", imageID) + if strings.Contains(err.Error(),"Maximum supported API version is"){ + color.Yellow("Use the -sV flag to change your client version. ./WhaleTail -sV=1.36 %s", imageID) + } return } defer out.Close() @@ -340,11 +342,16 @@ func printResults(layers []dockerHist) { color.White("") } + func cleanString(str string) string { s := strings.Join(strings.Fields(str), " ") - s = strings.Replace(s, "&&", " \\\n&&", -1) - s = strings.Replace(s, "/bin/sh -c ", "", -1) - s = strings.Replace(s, "#(nop) ", "", -1) + s = strings.Replace(s, "&&", " \\\n\t&&", -1) + if !strings.HasPrefix(s, "/bin/sh -c #(nop)"){ + s = strings.Replace(s, "/bin/sh -c ", "RUN ", -1) + } else { + s = strings.Replace(s, "/bin/sh -c ", "", -1) + s = strings.Replace(s, "#(nop) ", "", -1) + } return s }