From fad2354e894b1b642c9765c5272aa1939b7c0be4 Mon Sep 17 00:00:00 2001 From: Alex Goodman <wagoodman@gmail.com> Date: Sun, 21 Oct 2018 13:03:10 -0400 Subject: [PATCH] fixed inefficient file report bug --- cmd/build.go | 2 +- cmd/root.go | 10 +++++----- ui/detailsview.go | 3 +-- utils/docker.go | 3 +-- 4 files changed, 8 insertions(+), 10 deletions(-) diff --git a/cmd/build.go b/cmd/build.go index d6fe2fd..49c41b2 100644 --- a/cmd/build.go +++ b/cmd/build.go @@ -5,9 +5,9 @@ import ( "github.com/spf13/cobra" "github.com/wagoodman/dive/image" "github.com/wagoodman/dive/ui" + "github.com/wagoodman/dive/utils" "io/ioutil" "os" - "github.com/wagoodman/dive/utils" ) // buildCmd represents the build command diff --git a/cmd/root.go b/cmd/root.go index c78421f..47dbb97 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -2,13 +2,13 @@ package cmd import ( "fmt" + "github.com/k0kubun/go-ansi" "github.com/mitchellh/go-homedir" log "github.com/sirupsen/logrus" "github.com/spf13/cobra" "github.com/spf13/viper" - "os" "github.com/tebeka/atexit" - "github.com/k0kubun/go-ansi" + "os" ) var cfgFile string @@ -17,10 +17,10 @@ var cfgFile string var rootCmd = &cobra.Command{ Use: "dive [IMAGE]", Short: "Docker Image Visualizer & Explorer", - Long: `This tool provides a way to discover and explore the contents of a docker image. Additionally the tool estimates + Long: `This tool provides a way to discover and explore the contents of a docker image. Additionally the tool estimates the amount of wasted space and identifies the offending files from the image.`, - Args: cobra.ExactArgs(1), - Run: analyze, + Args: cobra.ExactArgs(1), + Run: analyze, } // Execute adds all child commands to the root command and sets flags appropriately. diff --git a/ui/detailsview.go b/ui/detailsview.go index 778b1fb..3753a7d 100644 --- a/ui/detailsview.go +++ b/ui/detailsview.go @@ -2,7 +2,6 @@ package ui import ( "fmt" - "github.com/dustin/go-humanize" "github.com/jroimartin/gocui" "github.com/lunixbochs/vtclean" @@ -97,7 +96,7 @@ func (view *DetailsView) Render() error { template := "%5s %12s %-s\n" var trueInefficiencies int inefficiencyReport := fmt.Sprintf(Formatting.Header(template), "Count", "Total Space", "Path") - for idx := len(view.inefficiencies) - 1; idx > 0; idx-- { + for idx := len(view.inefficiencies) - 1; idx >= 0; idx-- { data := view.inefficiencies[idx] if data.CumulativeSize == 0 { continue diff --git a/utils/docker.go b/utils/docker.go index 339b0a9..786a3a4 100644 --- a/utils/docker.go +++ b/utils/docker.go @@ -1,8 +1,8 @@ package utils import ( - "os/exec" "os" + "os/exec" "strings" ) @@ -30,4 +30,3 @@ func cleanArgs(s []string) []string { } return r } -