gofmt
This commit is contained in:
parent
8ca96849da
commit
e700ec3745
@ -1,12 +1,12 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"github.com/spf13/cobra"
|
||||
"fmt"
|
||||
"os"
|
||||
"github.com/fatih/color"
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/wagoodman/dive/image"
|
||||
"github.com/wagoodman/dive/ui"
|
||||
"github.com/fatih/color"
|
||||
"os"
|
||||
)
|
||||
|
||||
// analyze takes a docker image tag, digest, or id and displayes the
|
||||
|
10
cmd/build.go
10
cmd/build.go
@ -1,14 +1,14 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"github.com/spf13/cobra"
|
||||
"os/exec"
|
||||
"os"
|
||||
"strings"
|
||||
"io/ioutil"
|
||||
log "github.com/sirupsen/logrus"
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/wagoodman/dive/image"
|
||||
"github.com/wagoodman/dive/ui"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"os/exec"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// buildCmd represents the build command
|
||||
|
@ -2,11 +2,11 @@ package cmd
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"github.com/mitchellh/go-homedir"
|
||||
log "github.com/sirupsen/logrus"
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/spf13/viper"
|
||||
log "github.com/sirupsen/logrus"
|
||||
"os"
|
||||
)
|
||||
|
||||
var cfgFile string
|
||||
|
@ -40,7 +40,7 @@ type FileInfo struct {
|
||||
type DiffType int
|
||||
|
||||
// NewNodeData creates an empty NodeData struct for a FileNode
|
||||
func NewNodeData() (*NodeData) {
|
||||
func NewNodeData() *NodeData {
|
||||
return &NodeData{
|
||||
ViewInfo: *NewViewInfo(),
|
||||
FileInfo: FileInfo{},
|
||||
@ -49,7 +49,7 @@ func NewNodeData() (*NodeData) {
|
||||
}
|
||||
|
||||
// Copy duplicates a NodeData
|
||||
func (data *NodeData) Copy() (*NodeData) {
|
||||
func (data *NodeData) Copy() *NodeData {
|
||||
return &NodeData{
|
||||
ViewInfo: *data.ViewInfo.Copy(),
|
||||
FileInfo: *data.FileInfo.Copy(),
|
||||
@ -57,7 +57,6 @@ func (data *NodeData) Copy() (*NodeData) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// NewViewInfo creates a default ViewInfo
|
||||
func NewViewInfo() (view *ViewInfo) {
|
||||
return &ViewInfo{
|
||||
@ -120,7 +119,6 @@ func (data *FileInfo) Compare(other FileInfo) DiffType {
|
||||
return Changed
|
||||
}
|
||||
|
||||
|
||||
// String of a DiffType
|
||||
func (diff DiffType) String() string {
|
||||
switch diff {
|
||||
@ -145,5 +143,3 @@ func (diff DiffType) merge(other DiffType) DiffType {
|
||||
}
|
||||
return Changed
|
||||
}
|
||||
|
||||
|
||||
|
@ -66,7 +66,6 @@ func Efficiency(trees []*FileTree) (float64, EfficiencySlice) {
|
||||
tree.VisitDepthChildFirst(visitor, visitEvaluator)
|
||||
}
|
||||
|
||||
|
||||
// calculate the score
|
||||
var minimumPathSizes int64
|
||||
var discoveredPathSizes int64
|
||||
@ -81,5 +80,3 @@ func Efficiency(trees []*FileTree) (float64, EfficiencySlice) {
|
||||
|
||||
return score, inefficientMatches
|
||||
}
|
||||
|
||||
|
||||
|
@ -47,4 +47,3 @@ package filetree
|
||||
// t.Fatalf("Expected %f but got %f", expected, actual)
|
||||
// }
|
||||
// }
|
||||
|
||||
|
@ -44,7 +44,6 @@ func TestAddChild(t *testing.T) {
|
||||
t.Errorf("Expected 'ones' payload to be %+v got %+v.", expectedFC, actualFC)
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
func TestRemoveChild(t *testing.T) {
|
||||
|
@ -2,9 +2,9 @@ package filetree
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
"github.com/satori/go.uuid"
|
||||
"sort"
|
||||
"strings"
|
||||
)
|
||||
|
||||
const (
|
||||
|
@ -13,10 +13,10 @@ import (
|
||||
"strings"
|
||||
|
||||
"github.com/docker/docker/client"
|
||||
"github.com/wagoodman/dive/filetree"
|
||||
"golang.org/x/net/context"
|
||||
"github.com/wagoodman/jotframe"
|
||||
"github.com/k0kubun/go-ansi"
|
||||
"github.com/wagoodman/dive/filetree"
|
||||
"github.com/wagoodman/jotframe"
|
||||
"golang.org/x/net/context"
|
||||
)
|
||||
|
||||
// TODO: this file should be rethought... but since it's only for preprocessing it'll be tech debt for now.
|
||||
@ -263,7 +263,6 @@ func InitializeData(imageID string) ([]*Layer, []*filetree.FileTree) {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
|
||||
go processLayerTar(line, layerMap, name, tarredBytes)
|
||||
|
||||
} else if name == "manifest.json" {
|
||||
|
@ -1,10 +1,10 @@
|
||||
package image
|
||||
|
||||
import (
|
||||
"github.com/wagoodman/dive/filetree"
|
||||
"strings"
|
||||
"fmt"
|
||||
"github.com/dustin/go-humanize"
|
||||
"github.com/wagoodman/dive/filetree"
|
||||
"strings"
|
||||
)
|
||||
|
||||
const (
|
||||
@ -44,4 +44,3 @@ func (layer *Layer) String() string {
|
||||
humanize.Bytes(uint64(layer.History.Size)),
|
||||
strings.TrimPrefix(layer.History.CreatedBy, "/bin/sh -c "))
|
||||
}
|
||||
|
||||
|
@ -3,12 +3,12 @@ package ui
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/dustin/go-humanize"
|
||||
"github.com/jroimartin/gocui"
|
||||
"github.com/lunixbochs/vtclean"
|
||||
"strings"
|
||||
"github.com/wagoodman/dive/filetree"
|
||||
"strconv"
|
||||
"github.com/dustin/go-humanize"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// DetailsView holds the UI objects and data models for populating the lower-left pane. Specifically the pane that
|
||||
@ -61,7 +61,9 @@ func (view *DetailsView) Setup(v *gocui.View, header *gocui.View) error {
|
||||
|
||||
// IsVisible indicates if the details view pane is currently initialized.
|
||||
func (view *DetailsView) IsVisible() bool {
|
||||
if view == nil {return false}
|
||||
if view == nil {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
|
@ -6,8 +6,8 @@ import (
|
||||
"strings"
|
||||
|
||||
"github.com/jroimartin/gocui"
|
||||
"github.com/wagoodman/dive/filetree"
|
||||
"github.com/lunixbochs/vtclean"
|
||||
"github.com/wagoodman/dive/filetree"
|
||||
)
|
||||
|
||||
const (
|
||||
@ -102,7 +102,9 @@ func (view *FileTreeView) height() uint {
|
||||
|
||||
// IsVisible indicates if the file tree view pane is currently initialized
|
||||
func (view *FileTreeView) IsVisible() bool {
|
||||
if view == nil {return false}
|
||||
if view == nil {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
@ -178,7 +180,6 @@ func (view *FileTreeView) CursorDown() error {
|
||||
return view.Render()
|
||||
}
|
||||
|
||||
|
||||
// CursorUp moves the cursor up and renders the view.
|
||||
// Note: we cannot use the gocui buffer since any state change requires writing the entire tree to the buffer.
|
||||
// Instead we are keeping an upper and lower bounds of the tree string to render and only flushing
|
||||
|
@ -55,7 +55,9 @@ func (view *FilterView) Setup(v *gocui.View, header *gocui.View) error {
|
||||
|
||||
// IsVisible indicates if the filter view pane is currently initialized
|
||||
func (view *FilterView) IsVisible() bool {
|
||||
if view == nil {return false}
|
||||
if view == nil {
|
||||
return false
|
||||
}
|
||||
return !view.hidden
|
||||
}
|
||||
|
||||
|
@ -3,10 +3,10 @@ package ui
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/jroimartin/gocui"
|
||||
"github.com/wagoodman/dive/image"
|
||||
"github.com/lunixbochs/vtclean"
|
||||
"github.com/dustin/go-humanize"
|
||||
"github.com/jroimartin/gocui"
|
||||
"github.com/lunixbochs/vtclean"
|
||||
"github.com/wagoodman/dive/image"
|
||||
"strings"
|
||||
)
|
||||
|
||||
@ -69,7 +69,9 @@ func (view *LayerView) Setup(v *gocui.View, header *gocui.View) error {
|
||||
|
||||
// IsVisible indicates if the layer view pane is currently initialized.
|
||||
func (view *LayerView) IsVisible() bool {
|
||||
if view == nil {return false}
|
||||
if view == nil {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
@ -208,7 +210,6 @@ func (view *LayerView) Render() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
// KeyHelp indicates all the possible actions a user can take while the current pane is selected.
|
||||
func (view *LayerView) KeyHelp() string {
|
||||
return renderStatusOption("^L", "Show layer changes", view.CompareMode == CompareLayer) +
|
||||
|
@ -40,7 +40,9 @@ func (view *StatusView) Setup(v *gocui.View, header *gocui.View) error {
|
||||
|
||||
// IsVisible indicates if the status view pane is currently initialized.
|
||||
func (view *StatusView) IsVisible() bool {
|
||||
if view == nil {return false}
|
||||
if view == nil {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
|
21
ui/ui.go
21
ui/ui.go
@ -5,10 +5,10 @@ import (
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
"github.com/fatih/color"
|
||||
"github.com/jroimartin/gocui"
|
||||
"github.com/wagoodman/dive/filetree"
|
||||
"github.com/wagoodman/dive/image"
|
||||
"github.com/fatih/color"
|
||||
"os"
|
||||
"runtime"
|
||||
"runtime/pprof"
|
||||
@ -35,14 +35,14 @@ func debugPrint(s string) {
|
||||
|
||||
// Formatting defines standard functions for formatting UI sections.
|
||||
var Formatting struct {
|
||||
Header func(...interface{})(string)
|
||||
Selected func(...interface{})(string)
|
||||
StatusSelected func(...interface{})(string)
|
||||
StatusNormal func(...interface{})(string)
|
||||
StatusControlSelected func(...interface{})(string)
|
||||
StatusControlNormal func(...interface{})(string)
|
||||
CompareTop func(...interface{})(string)
|
||||
CompareBottom func(...interface{})(string)
|
||||
Header func(...interface{}) string
|
||||
Selected func(...interface{}) string
|
||||
StatusSelected func(...interface{}) string
|
||||
StatusNormal func(...interface{}) string
|
||||
StatusControlSelected func(...interface{}) string
|
||||
StatusControlNormal func(...interface{}) string
|
||||
CompareTop func(...interface{}) string
|
||||
CompareBottom func(...interface{}) string
|
||||
}
|
||||
|
||||
// Views contains all rendered UI panes.
|
||||
@ -179,7 +179,6 @@ func isNewView(errs ...error) bool {
|
||||
return true
|
||||
}
|
||||
|
||||
|
||||
// layout defines the definition of the window pane size and placement relations to one another. This
|
||||
// is invoked at application start and whenever the screen dimensions change.
|
||||
func layout(g *gocui.Gui) error {
|
||||
@ -260,7 +259,6 @@ func layout(g *gocui.Gui) error {
|
||||
Views.Filter.Setup(view, header)
|
||||
}
|
||||
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -324,7 +322,6 @@ func Run(layers []*image.Layer, refTrees []*filetree.FileTree) {
|
||||
Views.Details = NewDetailsView("details", g)
|
||||
Views.lookup[Views.Details.Name] = Views.Details
|
||||
|
||||
|
||||
g.Cursor = false
|
||||
//g.Mouse = true
|
||||
g.SetManagerFunc(layout)
|
||||
|
Loading…
x
Reference in New Issue
Block a user