diff --git a/runtime/ci/evaluator.go b/runtime/ci/evaluator.go index f8baeec..b567e9c 100644 --- a/runtime/ci/evaluator.go +++ b/runtime/ci/evaluator.go @@ -2,13 +2,14 @@ package ci import ( "fmt" - "github.com/dustin/go-humanize" - "github.com/wagoodman/dive/dive/image" - "github.com/wagoodman/dive/utils" "sort" "strconv" "strings" + "github.com/dustin/go-humanize" + "github.com/wagoodman/dive/dive/image" + "github.com/wagoodman/dive/utils" + "github.com/spf13/viper" "github.com/logrusorgru/aurora" diff --git a/runtime/ci/evaluator_test.go b/runtime/ci/evaluator_test.go index d929452..7433588 100644 --- a/runtime/ci/evaluator_test.go +++ b/runtime/ci/evaluator_test.go @@ -1,10 +1,11 @@ package ci import ( - "github.com/wagoodman/dive/dive/image/docker" "strings" "testing" + "github.com/wagoodman/dive/dive/image/docker" + "github.com/spf13/viper" ) diff --git a/runtime/ci/rule.go b/runtime/ci/rule.go index 60b350d..3605571 100644 --- a/runtime/ci/rule.go +++ b/runtime/ci/rule.go @@ -2,9 +2,10 @@ package ci import ( "fmt" - "github.com/wagoodman/dive/dive/image" "strconv" + "github.com/wagoodman/dive/dive/image" + "github.com/spf13/viper" "github.com/dustin/go-humanize" diff --git a/runtime/export/export.go b/runtime/export/export.go index 8085afc..e4c8308 100644 --- a/runtime/export/export.go +++ b/runtime/export/export.go @@ -2,6 +2,7 @@ package export import ( "encoding/json" + diveImage "github.com/wagoodman/dive/dive/image" ) diff --git a/runtime/export/export_test.go b/runtime/export/export_test.go index 3d6d1d2..5e5586f 100644 --- a/runtime/export/export_test.go +++ b/runtime/export/export_test.go @@ -1,9 +1,10 @@ package export import ( + "testing" + "github.com/sergi/go-diff/diffmatchpatch" "github.com/wagoodman/dive/dive/image/docker" - "testing" ) func Test_Export(t *testing.T) { diff --git a/runtime/run_test.go b/runtime/run_test.go index faca379..06c139c 100644 --- a/runtime/run_test.go +++ b/runtime/run_test.go @@ -2,14 +2,15 @@ package runtime import ( "fmt" + "os" + "testing" + "github.com/lunixbochs/vtclean" "github.com/spf13/afero" "github.com/spf13/viper" "github.com/wagoodman/dive/dive" "github.com/wagoodman/dive/dive/image" "github.com/wagoodman/dive/dive/image/docker" - "os" - "testing" ) type defaultResolver struct{} diff --git a/runtime/ui/app.go b/runtime/ui/app.go index 4b1079f..019420d 100644 --- a/runtime/ui/app.go +++ b/runtime/ui/app.go @@ -78,8 +78,7 @@ func newApp(app *tview.Application, analysis *image.AnalysisResult, cache filetr leftVisibleGrid.AddItem(layersBox, 0, 3, true). AddItem(layerDetailsBox, 0, 1, false). - AddItem(imageDetailsBox, 0 , 1, false) - + AddItem(imageDetailsBox, 0, 1, false) rightVisibleGrid.AddItem(fileTreeBox, 0, 1, false). AddItem(filterView, 1, 0, false). @@ -88,7 +87,6 @@ func newApp(app *tview.Application, analysis *image.AnalysisResult, cache filetr totalVisibleGrid.AddItem(leftVisibleGrid, 0, 1, true). AddItem(rightVisibleGrid, 0, 1, false) - appSingleton = &diveApp{ app: app, fileTree: fileTreeBox, @@ -146,7 +144,7 @@ func Run(analysis *image.AnalysisResult, treeStack filetree.Comparer, isCNB bool if err != nil { return err } - + if err = appSingleton.app.Run(); err != nil { zap.S().Info("app error: ", err.Error()) return err diff --git a/runtime/ui/components/filetree_primative.go b/runtime/ui/components/filetree_primative.go index 21891b8..af95a11 100644 --- a/runtime/ui/components/filetree_primative.go +++ b/runtime/ui/components/filetree_primative.go @@ -2,12 +2,13 @@ package components import ( "bytes" + "io" + "strings" + "github.com/gdamore/tcell/v2" "github.com/rivo/tview" "github.com/sirupsen/logrus" "github.com/wagoodman/dive/dive/filetree" - "io" - "strings" ) // TODO simplify this interface. diff --git a/runtime/ui/components/image_details_view.go b/runtime/ui/components/image_details_view.go index ce64c87..7020c73 100644 --- a/runtime/ui/components/image_details_view.go +++ b/runtime/ui/components/image_details_view.go @@ -2,11 +2,12 @@ package components import ( "fmt" + "strconv" + "github.com/dustin/go-humanize" "github.com/gdamore/tcell/v2" "github.com/rivo/tview" "github.com/wagoodman/dive/dive/image" - "strconv" ) type ImageDetails struct { diff --git a/runtime/ui/components/layer_details_view.go b/runtime/ui/components/layer_details_view.go index e5c83e8..a38f811 100644 --- a/runtime/ui/components/layer_details_view.go +++ b/runtime/ui/components/layer_details_view.go @@ -2,10 +2,11 @@ package components import ( "fmt" + "strings" + "github.com/gdamore/tcell/v2" "github.com/rivo/tview" "github.com/wagoodman/dive/dive/image" - "strings" ) type LayerDetailModel interface { diff --git a/runtime/ui/components/layers_primative.go b/runtime/ui/components/layers_primative.go index 1317c2f..5968a6a 100644 --- a/runtime/ui/components/layers_primative.go +++ b/runtime/ui/components/layers_primative.go @@ -2,6 +2,7 @@ package components import ( "fmt" + "github.com/gdamore/tcell/v2" "github.com/rivo/tview" "github.com/sirupsen/logrus" diff --git a/runtime/ui/components/visible_primitive.go b/runtime/ui/components/visible_primitive.go index 1a145c5..02c92de 100644 --- a/runtime/ui/components/visible_primitive.go +++ b/runtime/ui/components/visible_primitive.go @@ -19,7 +19,6 @@ func AlwaysVisible(_ tview.Primitive) bool { return true } - // How can we actually implement this???? // Either we have to do one of the following // 1) we want to use particular and specific methods on an item diff --git a/runtime/ui/viewmodels/cnb_layer_details_model.go b/runtime/ui/viewmodels/cnb_layer_details_model.go index acc3e6c..974ed76 100644 --- a/runtime/ui/viewmodels/cnb_layer_details_model.go +++ b/runtime/ui/viewmodels/cnb_layer_details_model.go @@ -13,11 +13,11 @@ type CNBLayersViewModel struct { func NewCNBLayersViewModel(layers []*image.Layer, bomMapping map[string]lifecycle.BOMEntry) *CNBLayersViewModel { return &CNBLayersViewModel{ LayersViewModel: NewLayersViewModel(layers), - bomMapping: bomMapping, + bomMapping: bomMapping, } } -func (cvm *CNBLayersViewModel) GetBOMFromDigest(layerSha string) lifecycle.BOMEntry{ +func (cvm *CNBLayersViewModel) GetBOMFromDigest(layerSha string) lifecycle.BOMEntry { result, ok := cvm.bomMapping[layerSha] if !ok { return lifecycle.BOMEntry{} diff --git a/runtime/ui/viewmodels/layers_view_model.go b/runtime/ui/viewmodels/layers_view_model.go index e870f20..4418152 100644 --- a/runtime/ui/viewmodels/layers_view_model.go +++ b/runtime/ui/viewmodels/layers_view_model.go @@ -2,6 +2,7 @@ package viewmodels import ( "fmt" + "github.com/sirupsen/logrus" "github.com/wagoodman/dive/dive/filetree" "github.com/wagoodman/dive/dive/image" @@ -15,14 +16,14 @@ const ( type LayerCompareMode int type LayersViewModel struct { - mode LayerCompareMode + mode LayerCompareMode layers []*image.Layer - index int + index int } func NewLayersViewModel(layers []*image.Layer) *LayersViewModel { return &LayersViewModel{ - mode: CompareSingleLayer, + mode: CompareSingleLayer, layers: layers, } } @@ -32,11 +33,11 @@ func (lm *LayersViewModel) GetMode() LayerCompareMode { } func (lm *LayersViewModel) SwitchMode() { - lm.mode = (lm.mode + 1)%2 //this just cycles the mode + lm.mode = (lm.mode + 1) % 2 //this just cycles the mode } func (lm *LayersViewModel) GetCompareIndicies() filetree.TreeIndexKey { - intMax := func (i,j int) int { + intMax := func(i, j int) int { if i > j { return i } @@ -48,7 +49,7 @@ func (lm *LayersViewModel) GetCompareIndicies() filetree.TreeIndexKey { if lm.mode == CompareSingleLayer { bottomStop = intMax(lm.index-1, 0) } - return filetree.NewTreeIndexKey(bottomStart,bottomStop,lm.index,lm.index) + return filetree.NewTreeIndexKey(bottomStart, bottomStop, lm.index, lm.index) } func (lm *LayersViewModel) SetLayerIndex(index int) bool { diff --git a/utils/format.go b/utils/format.go index 77a9d59..cabdbc1 100644 --- a/utils/format.go +++ b/utils/format.go @@ -1,8 +1,9 @@ package utils import ( - "github.com/logrusorgru/aurora" "strings" + + "github.com/logrusorgru/aurora" ) func TitleFormat(s string) string {