mirror of
https://github.com/wagoodman/dive
synced 2026-03-14 22:35:50 +01:00
formatting and import changes using goimports
This commit is contained in:
parent
d93c673810
commit
6666e841eb
15 changed files with 35 additions and 26 deletions
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package export
|
|||
|
||||
import (
|
||||
"encoding/json"
|
||||
|
||||
diveImage "github.com/wagoodman/dive/dive/image"
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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{}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package components
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/gdamore/tcell/v2"
|
||||
"github.com/rivo/tview"
|
||||
"github.com/sirupsen/logrus"
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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{}
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -1,8 +1,9 @@
|
|||
package utils
|
||||
|
||||
import (
|
||||
"github.com/logrusorgru/aurora"
|
||||
"strings"
|
||||
|
||||
"github.com/logrusorgru/aurora"
|
||||
)
|
||||
|
||||
func TitleFormat(s string) string {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue