fixed inefficient file report bug

This commit is contained in:
Alex Goodman 2018-10-21 13:03:10 -04:00
parent 3ea8c0ab4a
commit fad2354e89
No known key found for this signature in database
GPG Key ID: 05328C611D8A520E
4 changed files with 8 additions and 10 deletions

View File

@ -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

View File

@ -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.

View File

@ -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

View File

@ -1,8 +1,8 @@
package utils
import (
"os/exec"
"os"
"os/exec"
"strings"
)
@ -30,4 +30,3 @@ func cleanArgs(s []string) []string {
}
return r
}