formatting and import changes using goimports

This commit is contained in:
dwillist 2020-12-19 02:37:20 -05:00
commit 6666e841eb
15 changed files with 35 additions and 26 deletions

View file

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

View file

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

View file

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

View file

@ -2,6 +2,7 @@ package export
import (
"encoding/json"
diveImage "github.com/wagoodman/dive/dive/image"
)

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -2,6 +2,7 @@ package components
import (
"fmt"
"github.com/gdamore/tcell/v2"
"github.com/rivo/tview"
"github.com/sirupsen/logrus"

View file

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

View file

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

View file

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

View file

@ -1,8 +1,9 @@
package utils
import (
"github.com/logrusorgru/aurora"
"strings"
"github.com/logrusorgru/aurora"
)
func TitleFormat(s string) string {