text
stringlengths
14
100k
source
stringclasses
1 value
repo
stringclasses
810 values
language
stringclasses
13 values
<|fim_prefix|>package ci import ( "context" "github.com/stretchr/testify/require" "go.uber.org/atomic" "os/exec" "path/filepath" "strings" "testing" "github.com/wagoodman/dive/dive/image/docker" ) var repoRootCache atomic.String func Test_Evaluator(t *testing.T) { result := docker.TestAnalysisFromArchive(t...
fim
wagoodman/dive
go
<|fim_prefix|>package ci import ( "github.com/wagoodman/dive/dive/image" ) const ( RuleUnknown = iota RulePassed RuleFailed RuleWarning RuleDisabled RuleMisconfigured RuleConfigured ) type Rule interface { Key() string Configuration() string Evaluate(result *image.Analysis) (RuleSt<|fim_suffix|>known") }...
fim
wagoodman/dive
go
package ci import ( "errors" "fmt" "github.com/dustin/go-humanize" "github.com/wagoodman/dive/dive/image" "strconv" "strings" ) const ( ciKeyLowestEfficiencyThreshold = "lowestEfficiency" ciKeyHighestWastedBytes = "highestWastedBytes" ciKeyHighestUserWastedPercent = "highestUserWastedPercent" ) func...
fim
wagoodman/dive
go
<|fim_suffix|> FileList: layerFileList, } } // add file references for idx := 0; idx < len(analysis.Inefficiencies); idx++ { fileData := analysis.Inefficiencies[len(analysis.Inefficiencies)-1-idx] data.Image.InefficientFiles[idx] = FileReference{ References: len(fileData.Nodes), SizeBytes: uint64(fi...
fim
wagoodman/dive
go
<|fim_prefix|>package export import ( "testing" "github.com/wagoodman/dive/dive/image/docker" ) func Test_Export(t *testing.T) { result := <|fim_suffix|>unable to export analysis: %v", err) } snaps.MatchJSON(t, payload) } <|fim_middle|>docker.TestAnalysisFromArchive(t, repoPath(t, ".data/test-docker-image.tar"...
fim
wagoodman/dive
go
<|fim_prefix|>package export import ( "flag" "github.com/charmbracelet/lipgloss" snapsPkg "github.com/gkampitakis/go-snaps/snaps" "github.com/muesli/termenv" "github.com/stretchr/testify/require" "go.uber.org/atomic" "os" "os/exec" "path/filepath" "strings" "testing" ) var ( updateSnapshot = flag.Bool("up...
fim
wagoodman/dive
go
package command import ( "context" "errors" "fmt" "github.com/anchore/clio" "github.com/spf13/afero" "github.com/spf13/cobra" "github.com/wagoodman/dive/cmd/dive/cli/internal/command/adapter" "github.com/wagoodman/dive/cmd/dive/cli/internal/options" "github.com/wagoodman/dive/cmd/dive/cli/internal/ui" "githu...
fim
wagoodman/dive
go
<|fim_suffix|>r engine: %s (valid options: %s), using default %q", c.ContainerEngine, strings.Join(c.AvailableContainerEngines, ", "), defaultContainerEngine) c.ContainerEngine = "docker" } if c.Image != "" { sourceType, imageStr := dive.DeriveImageSource(c.Image) if sourceType == dive.SourceUnknown { sour...
fim
wagoodman/dive
go
<|fim_suffix|>structure:",squash"` UI UI `yaml:",inline" mapstructure:",squash"` } func DefaultApplication() Application { return Application{ Analysis: DefaultAnalysis(), CI: DefaultCI(), Export: DefaultExport(), UI: DefaultUI(), } } func (c Application) V1Preferences() v1.Prefer...
fim
wagoodman/dive
go
package options import ( "fmt" "github.com/anchore/clio" "gopkg.in/yaml.v3" "os" ) var _ interface { clio.PostLoader clio.FieldDescriber clio.FlagAdder } = (*CI)(nil) const defaultCIConfigPath = ".dive-ci" type CI struct { Enabled bool `yaml:"ci" mapstructure:"ci"` ConfigPath string `yaml:"ci-config...
fim
wagoodman/dive
go
<|fim_suffix|>0-1), otherwise CI validation will fail.") } func (c *CIRules) AddFlags(flags clio.FlagSet) { flags.StringVarP(&c.LowestEfficiencyThresholdString, "lowestEfficiency", "", "(only valid with --ci given) lowest allowable image efficiency (as a ratio between 0-1), otherwise CI validation will fail.") flags...
fim
wagoodman/dive
go
<|fim_prefix|>package options import ( "fmt" "os" "path" "github.com/anchore/clio" ) var _ interface { clio.FlagAdder clio.PostLoader } = (*Export)(nil) // Export provides configuration for data export functionality type Export struct { // Path to export analysis results as JSON (empty string = disabled) Js...
fim
wagoodman/dive
go
<|fim_prefix|>package options // UI combines all UI configuration elements typ<|fim_suffix|> DefaultUIFiletree(), Layer: DefaultUILayers(), } } <|fim_middle|>e UI struct { Keybinding UIKeybindings `yaml:"keybinding" mapstructure:"keybinding"` Diff UIDiff `yaml:"diff" mapstructure:"diff"` Filet...
fim
wagoodman/dive
go
<|fim_suffix|>e, } } func (c *UIDiff) DescribeFields(descriptions clio.FieldDescriptionSet) { descriptions.Add(&c.Hide, "types of file differences to hide (added, removed, modified, unmodified)") } func (c *UIDiff) PostLoad() error { validHideValues := map[string]bool{"added": true, "removed": true, "modified": tr...
fim
wagoodman/dive
go
<|fim_prefix|>package options import ( "github.com/anchore/clio" "github.com/wagoodman/dive/cmd/dive/cli/internal/ui/v1" "github.com/wagoodman/dive/internal/log" ) var _ interface { clio.PostLoader clio.FieldDescriber } = (*UIFiletree)(nil) // UIFiletree provides configuration for the file tree display type UIF...
fim
wagoodman/dive
go
<|fim_suffix|>w)") descriptions.Add(&c.Filetree.ToggleCollapseAllDir, "toggle collapse all directories (file view)") descriptions.Add(&c.Filetree.ToggleAddedFiles, "toggle visibility of added files (file view)") descriptions.Add(&c.Filetree.ToggleRemovedFiles, "toggle visibility of removed files (file view)") descr...
fim
wagoodman/dive
go
<|fim_prefix|>package options import "github.com/anchore/clio" var _ clio.FieldDescriber = (*UILayers)(nil) // UILayers provides configuration for layer display behavior ty<|fim_suffix|>ayers { return UILayers{ ShowAggregatedChanges: false, } } func (c *UILayers) DescribeFields(descriptions clio.FieldDescriptio...
fim
wagoodman/dive
go
<|fim_suffix|>e) error { n.subscription = subscription return nil } func (n *NoUI) Handle(_ partybus.Event) error { return nil } func (n NoUI) Teardown(_ bool) error { return nil } <|fim_prefix|>package ui import ( "github.com/wagoodman/go-partybus" "github<|fim_middle|>.com/anchore/clio" ) var _ clio.UI = (...
fim
wagoodman/dive
go
<|fim_prefix|>package app import ( "errors" "github.com/awesome-gocui/gocui" "github.com/wagoodman/dive/cmd/dive/cli/internal/ui/v1" "github.com/wagoodman/dive/cmd/dive/cli/internal/ui/v1/key" "github.com/wagoodman/dive/cmd/dive/cli/internal/ui/v1/layout" "github.com/wagoodman/dive/cmd/dive/cli/internal/ui/v1/la...
fim
wagoodman/dive
go
<|fim_prefix|>package app import ( "fmt" "github.com/wagoodman/dive/cmd/dive/cli/internal/ui/v1" "github.com/wagoodman/dive/cmd/dive/cli/internal/ui/v1/view" "github.com/wagoodman/dive/cmd/dive/cli/internal/ui/v1/viewmodel" "golang.org/x/net/context" "regexp" "github.com/awesome-gocui/gocui" ) type controller...
fim
wagoodman/dive
go
<|fim_prefix|>//go:build windows // +build windows package app import ( "github.com/awesome-gocui/gocui" ) // handle ctrl+z not supported on windows f<|fim_suffix|>Gui, _ *gocui.View) error { return nil } <|fim_middle|>unc handle_ctrl_z(_ *gocui.<|endoftext|>
fim
wagoodman/dive
go
//go:build !windows // +build !windows package app import ( "syscall" "github.com/awesome-gocui/gocui" ) // handle ctrl+z func handle_ctrl_z(g *gocui.Gui, v *gocui.View) error { gocui.Suspend() if err := syscall.Kill(syscall.Getpid(), syscall.SIGSTOP); err != nil { return err } return gocui.Resume() } <|end...
fim
wagoodman/dive
go
<|fim_prefix|>package v1 import ( "errors" "fmt" "github.com/wagoodman/dive/cmd/dive/cli/internal/ui/v1/key" "github.com/wagoodman/dive/dive/filetree" "github.com/wagoodman/dive/dive/image" "golang.org/x/net/context" "sync" ) type Config struct { // required input Analysis image.Analysis Content Cont...
fim
wagoodman/dive
go
<|fim_prefix|>package format import ( "fmt" "strings" "github.com/fatih/color" "github.com/lunixbochs/vtclean" ) const ( // selectedLeftBracketStr = " " // selectedRightBracketStr = " " // selectedFillStr = " " // //leftBracketStr = "▏" //rightBracketStr = "▕" //fillStr = "─" // selectedLeftBracketStr =...
fim
wagoodman/dive
go
<|fim_prefix|>package key import ( "fmt" "github.com/awesome-gocui/gocui" "github.com/awesome-gocui/keybinding" "github.com/wagoodman/dive/cmd/dive/cli/internal/ui/v1/format" ) type BindingInfo struct { Key gocui.Key Modifier gocui.Modifier Config Config OnAction func() error IsSelected func()...
fim
wagoodman/dive
go
<|fim_prefix|>package key import ( "fmt" "github.com/awesome-gocui/keybinding" ) type Config struct { Input string Keys []keybinding.Key `yaml:"-" mapstructure:"-"` } func (c *Config) Setup() error { if len(c.Input) == 0 { return nil } parsed, <|fim_suffix|> Config{Input: "ctrl+f, ctrl+slash"}, Close...
fim
wagoodman/dive
go
<|fim_suffix|>Y, maxX, maxY int } <|fim_prefix|>package layou<|fim_middle|>t type Area struct { minX, min<|endoftext|>
fim
wagoodman/dive
go
<|fim_prefix|>package compound import ( "fmt" "github.com/awesome-gocui/gocui" "github.com/wagoodman/dive/cmd/dive/cli/internal/ui/v1/view" "github.com/wagoodman/dive/internal/log" "github.com/wagoodman/dive/internal/utils" ) type LayerDetailsCompoundLayout struct { layer *view.Layer layerDetails...
fim
wagoodman/dive
go
<|fim_prefix|>package layout import "github.com/awesome-gocui/gocui" type Layout interface { Name() string Layout(g *gocui.Gui,<|fim_suffix|>axX, maxY int) error RequestedSize(available int) *int IsVisible() bool OnLayoutChange() error } <|fim_middle|> minX, minY, m<|endoftext|>
fim
wagoodman/dive
go
<|fim_suffix|>ype Location int <|fim_prefix|>package layout const ( Locati<|fim_middle|>onFooter Location = iota LocationHeader LocationColumn ) t<|endoftext|>
fim
wagoodman/dive
go
<|fim_prefix|>package layout import ( "fmt" "github.com/awesome-gocui/gocui" "github.com/wagoodman/dive/internal/log" ) type Constraint func(int) int type Manager struct { lastX, lastY int lastHeaderArea, lastFooterArea, lastColumnArea Area elements ...
fim
wagoodman/dive
go
<|fim_suffix|>: 79, minY: 0, maxX: 119, maxY: 79, }, LocationColumn), }, }, "1 header + 1 footer + 2 equal columns + 1 sized column": { elements: []*testElement{ newTestElement(t, 1, Area{ minX: -1, minY: -1, maxX: 120, maxY: 0, }, LocationHeader), ...
fim
wagoodman/dive
go
<|fim_prefix|>package view import ( "errors" "github.com/awesome-gocui/gocui" ) // CursorDown moves the cursor down in the currently selected gocui pane, scrolling the screen as needed. func CursorDown(g *gocui.Gui, v *gocui.View) error { return CursorStep(g, v, 1) } // CursorUp moves the cursor up in the curren...
fim
wagoodman/dive
go
<|fim_prefix|>package view import ( "fmt" "github.com/anchore/go-logger" "github.com/awesome-gocui/gocui" "github.com/wagoodman/dive/cmd/dive/cli/internal/ui/v1/format" "github.com/wagoodman/dive/internal/log" "github.com/wagoodman/dive/internal/utils" ) // Debug is just for me :) type Debug struct { name st...
fim
wagoodman/dive
go
<|fim_prefix|>package view import ( "fmt" "github.com/anchore/go-logger" "github.com/wagoodman/dive/cmd/dive/cli/internal/ui/v1" "github.com/wagoodman/dive/cmd/dive/cli/internal/ui/v1/format" "github.com/wagoodman/dive/cmd/dive/cli/internal/ui/v1/key" "github.com/wagoodman/dive/cmd/dive/cli/internal/ui<|fim_suff...
fim
wagoodman/dive
go
package view import ( "fmt" "github.com/anchore/go-logger" "github.com/wagoodman/dive/cmd/dive/cli/internal/ui/v1/format" "github.com/wagoodman/dive/internal/log" "github.com/wagoodman/dive/internal/utils" "strings" "github.com/awesome-gocui/gocui" ) type FilterEditListener func(string) error // Filter holds...
fim
wagoodman/dive
go
<|fim_suffix|> (v *ImageDetails) CursorUp() error { if err := CursorUp(v.gui, v.body); err != nil { v.logger.WithFields("error", err).Debug("couldn't move the cursor up") } return nil } func (v *ImageDetails) CursorDown() error { if err := CursorDown(v.gui, v.body); err != nil { v.logger.WithFields("error", er...
fim
wagoodman/dive
go
<|fim_prefix|>package view import ( "fmt" "github.com/anchore/go-logger" "github.com/awesome-gocui/gocui" "github.com/wagoodman/dive/cmd/dive/cli/internal/ui/v1" "github.com/wagoodman/dive/cmd/dive/cli/internal/ui/v1/format" "github.com/wagoodman/dive/cmd/dive/cli/internal/ui/v1/key" "github.com/wagoodman/dive/...
fim
wagoodman/dive
go
<|fim_suffix|>pe LayerChangeListener func(viewmodel.LayerSelection) error <|fim_prefix|>package view import ( "github<|fim_middle|>.com/wagoodman/dive/cmd/dive/cli/internal/ui/v1/viewmodel" ) ty<|endoftext|>
fim
wagoodman/dive
go
<|fim_prefix|>package view import ( "fmt" "github.com/anchore/go-logger" "github.com/wagoodman/dive/cmd/dive/cli/internal/ui/v1/format" "github.com/wagoodman/dive/cmd/dive/cli/internal/ui/v1/key" "github.com/wagoodman/dive/internal/log" "strings" "github.com/awesome-gocui/gocui" "github.com/dustin/go-humanize...
fim
wagoodman/dive
go
package view // Controller defines the a renderable terminal screen pane. type Renderer interface { Update() error Render() error IsVisible() bool } type Helper interface { KeyHelp() string } <|endoftext|>
fim
wagoodman/dive
go
<|fim_suffix|>tatus controller: %w", err) } } return nil } func (v *Status) RequestedSize(available int) *int { return &v.requestedHeight } <|fim_prefix|>package view import ( "fmt" "github.com/anchore/go-logger" "github.com/wagoodman/dive/cmd/dive/cli/internal/ui/v1/format" "github.com/wagoodman/dive/cmd/di...
fim
wagoodman/dive
go
<|fim_suffix|>cies: cfg.Analysis.Inefficiencies, kb: cfg.Preferences.KeyBindings, }, LayerDetails: &LayerDetails{gui: g, kb: cfg.Preferences.KeyBindings}, Debug: newDebugView(g), }, nil } func (views *Views) Renderers() []Renderer { return []Renderer{ views.Tree, views.Layer, views....
fim
wagoodman/dive
go
<|fim_suffix|> <|fim_prefix|><|fim_middle|>package viewmodel<|endoftext|>
fim
wagoodman/dive
go
<|fim_suffix|> to the top of the buffer and translates to the top of the buffer. func (vm *FileTreeViewModel) ResetCursor() { vm.TreeIndex = 0 vm.bufferIndex = 0 vm.bufferIndexLowerBound = 0 } // SetTreeByLayer populates the view model by stacking the indicated image layer file trees. func (vm *FileTreeViewModel) S...
fim
wagoodman/dive
go
<|fim_prefix|>package viewmodel import ( "flag" "github.com/google/go-cmp/cmp" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "github.com/wagoodman/dive/cmd/dive/cli/internal/ui/v1" "go.uber.org/atomic" "os" "os/exec" "path/filepath" "regexp" "strings" "testing" "github.com/wa...
fim
wagoodman/dive
go
<|fim_prefix|>package viewmodel const ( CompareSingleLayer LayerCompareMode =<|fim_suffix|>pareMode int <|fim_middle|> iota CompareAllLayers ) type LayerCom<|endoftext|>
fim
wagoodman/dive
go
<|fim_prefix|>package viewmodel import ( "github.com/wagoodman/dive/dive/image" ) type LayerSelec<|fim_suffix|> *image.Layer BottomTreeStart, BottomTreeStop, TopTreeStart, TopTreeStop int } <|fim_middle|>tion struct { Layer <|endoftext|>
fim
wagoodman/dive
go
package viewmodel import "github.com/wagoodman/dive/dive/image" type LayerSetState struct { LayerIndex int Layers []*image.Layer CompareMode LayerCompareMode CompareStartIndex int } func NewLayerSetState(layers []*image.Layer, compareMode LayerCompareMode) *LayerSetState { return &LayerS...
fim
wagoodman/dive
go
<|fim_prefix|>package viewmodel import ( "testing" ) func TestGetCompareIndexes(t *testing.T) { tests := []struct { name string layerIndex int compareMode LayerCompareMode compareStartIndex int expected [4]int }{ { name: "LayerIndex equals CompareStart...
fim
wagoodman/dive
go
<|fim_suffix|> return out } func (e environWithoutCI) Getenv(s string) string { if s == "CI" { return "" } return os.Getenv(s) } func (n *V1UI) Handle(e partybus.Event) error { switch e.Type { case event.TaskStarted: if n.quiet { return nil } prog, task, err := parser.ParseTaskStarted(e) if err != ...
fim
wagoodman/dive
go
<|fim_suffix|>scription, }, ) app.Run() } <|fim_prefix|>package main // Copyright © 2018 Alex Goodman // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, includin...
fim
wagoodman/dive
go
<|fim_suffix|>re (top tree SIZE is fixed (BUT floats forward), Bottom tree SIZE changes) func (cmp *Comparer) NaturalIndexes() <-chan TreeIndexKey { indexes := make(chan TreeIndexKey) go func() { defer close(indexes) var bottomTreeStart, bottomTreeStop, topTreeStart, topTreeStop int for selectIdx := 0; selec...
fim
wagoodman/dive
go
<|fim_prefix|>package filetree import ( "fmt" ) const ( Unmodified DiffType = iota Modified Added Removed ) // DiffType defines the comparison result between two FileNodes type DiffType int // String of a DiffType func (diff DiffType) String() string { switch diff { case Unmodified: return "Unmodified" ca...
fim
wagoodman/dive
go
<|fim_prefix|>package filetree <|fim_suffix|>{ currentTree = idx err := tree.VisitDepthChildFirst(visitor, visitEvaluator) if err != nil { log.WithFields("layer", tree.Id, "error", err).Debug("unable to propagate layer tree") } } // calculate the score var minimumPathSizes int64 var discoveredPathSizes ...
fim
wagoodman/dive
go
<|fim_suffix|>eSize != actualMatches[0].CumulativeSize { t.Errorf("Expected cumulative size of %v but go %v", expectedMatches[0].CumulativeSize, actualMatches[0].CumulativeSize) } } func TestEfficiency_ScratchImage(t *testing.T) { trees := make([]*FileTree, 3) for idx := range trees { trees[idx] = NewFileTree()...
fim
wagoodman/dive
go
<|fim_suffix|> n, err := reader.Read(buf) if err != nil && err != io.EOF { panic(fmt.Errorf("unable to read file: %w", err)) } if n == 0 { break } _, err = h.Write(buf[:n]) if err != nil { panic(fmt.Errorf("unable to write to hash: %w", err)) } } return h.Sum64() } <|fim_prefix|>package file...
fim
wagoodman/dive
go
<|fim_prefix|>package filetree import ( "archive/tar" "fmt" "github.com/wagoodman/dive/internal/log" "strings" "github.com/dustin/go-humanize" "github.com/fatih/color" "github.com/phayes/permbits" ) const ( AttributeFormat = "%s%s %11s %10s " ) var diffTypeColor = map[DiffType]*color.Color{ Added: col...
fim
wagoodman/dive
go
<|fim_suffix|>stDiffTypeFromRemovedChildren(t *testing.T) { tree := NewFileTree() _, _, _ = tree.AddPath("/usr", *BlankFileChangeInfo("/usr")) info1 := BlankFileChangeInfo("/usr/.wh.bin") node, _, _ := tree.AddPath("/usr/.wh.bin", *info1) node.Data.DiffType = Removed info2 := BlankFileChangeInfo("/usr/.wh.bin2"...
fim
wagoodman/dive
go
<|fim_suffix|> 0; idx-- { newNode := newNodes[idx] modifications = append(modifications, compareMark{lowerNode: newNode, upperNode: upperNode, tentative: -1, final: Added}) } return nil } // the file exists in the lower layer lowerNode, _ := tree.GetNode(upperNode.Path()) diffType := lowerNode.co...
fim
wagoodman/dive
go
<|fim_suffix|> } else { if err := AssertDiffType(n, Unmodified); err != nil { failedAssertions = append(failedAssertions, err) } } return nil } err = lowerTree.VisitDepthChildFirst(asserter, nil) if err != nil { t.Errorf("Expected no errors when visiting nodes, got: %+v", err) } if len(failedAss...
fim
wagoodman/dive
go
<|fim_suffix|>py() *NodeData { return &NodeData{ ViewInfo: *data.ViewInfo.Copy(), FileInfo: *data.FileInfo.Copy(), DiffType: data.DiffType, } } <|fim_prefix|>package filetree var GlobalFileTreeCollapse bool // NodeData is the payload for a FileNode type NodeData struct { ViewInfo ViewInfo FileInfo FileInfo ...
fim
wagoodman/dive
go
<|fim_prefix|>package filetree import ( "testing" ) func TestAssignD<|fim_suffix|>n &result } <|fim_middle|>iffType(t *testing.T) { tree := NewFileTree() node, _, err := tree.AddPath("/usr", *BlankFileChangeInfo("/usr")) if err != nil { t.Errorf("Expected no error from fetching path. got: %v", err) } node.Dat...
fim
wagoodman/dive
go
<|fim_suffix|>s { keys = append(keys, key) } sort.Slice(keys, func(i, j int) bool { ki, kj := keys[i], keys[j] ni, nj := files[ki], files[kj] if ni.GetSize() == nj.GetSize() { return ki < kj } return ni.GetSize() > nj.GetSize() }) return keys } <|fim_prefix|>package filetree import ( "sort" ) ty...
fim
wagoodman/dive
go
package filetree import "fmt" const ( ActionAdd FileAction = iota ActionRemove ) type FileAction int func (fa FileAction) String() string { switch fa { case ActionAdd: return "add" case ActionRemove: return "remove" default: return "<unknown file action>" } } type PathError struct { Path string Ac...
fim
wagoodman/dive
go
package filetree // ViewInfo contains UI specific detail for a specific FileNode type ViewInfo struct { Collapsed bool Hidden bool } // NewViewInfo creates a default ViewInfo func NewViewInfo() (view *ViewInfo) { return &ViewInfo{ Collapsed: GlobalFileTreeCollapse, Hidden: false, } } // Copy duplicates...
fim
wagoodman/dive
go
<|fim_suffix|>efault: return SourceUnknown } } func DeriveImageSource(image string) (ImageSource, string) { s := strings.SplitN(image, "://", 2) if len(s) < 2 { return SourceUnknown, "" } scheme, imageSource := s[0], s[1] switch scheme { case SourceDockerEngine.String(): return SourceDockerEngine, imageS...
fim
wagoodman/dive
go
<|fim_prefix|>package image import ( "context" "github.com/wagoodman/dive/dive/filetree" ) type Analysis struct { Image string Layers []*Layer RefTrees []*filetree.FileTree Efficiency float64 SizeBytes uint64 UserSizeByes uint64 // this is all bytes except ...
fim
wagoodman/dive
go
<|fim_suffix|> implemented") } <|fim_prefix|>package docker import ( "context" "fmt" "os" "github.com/wagoodman/div<|fim_middle|>e/dive/image" ) type archiveResolver struct{} func NewResolverFromArchive() *archiveResolver { return &archiveResolver{} } // Name returns the name of the resolver to display to the...
fim
wagoodman/dive
go
package docker import ( "fmt" "path/filepath" "strings" "github.com/scylladb/go-set/strset" "github.com/spf13/afero" ) const ( defaultDockerfileName = "Dockerfile" defaultContainerfileName = "Containerfile" ) func buildImageFromCli(fs afero.Fs, buildArgs []string) (string, error) { iidfile, err := afero....
fim
wagoodman/dive
go
<|fim_prefix|>package docker import ( "github.com/stretchr/testify/require" "path/filepath" "testing" "github.com/spf13/afero" "github.com/stretchr/testify/assert" ) func TestIsFileFlagsAreSet(t *testing.T) { tests := []struct { name string args []string flags []string expected bool }{ { ...
fim
wagoodman/dive
go
package docker import ( "fmt" "github.com/wagoodman/dive/internal/log" "github.com/wagoodman/dive/internal/utils" "os" "os/exec" "strings" ) // runDockerCmd runs a given Docker command in the current tty func runDockerCmd(cmdStr string, args ...string) error { if !isDockerClientBinaryAvailable() { return fm...
fim
wagoodman/dive
go
<|fim_suffix|>anic(fmt.Errorf("failed to unmarshal docker config: %w", err)) } layerIdx := 0 for idx := range imageConfig.History { if imageConfig.History[idx].EmptyLayer { imageConfig.History[idx].ID = "<missing>" } else { imageConfig.History[idx].ID = imageConfig.RootFs.DiffIds[layerIdx] layerIdx++ ...
fim
wagoodman/dive
go
<|fim_suffix|>ckerHost = "unix:///var/run/docker.sock" ) <|fim_prefix|>//go:build !windows pack<|fim_middle|>age docker const ( defaultDo<|endoftext|>
fim
wagoodman/dive
go
<|fim_prefix|>pack<|fim_suffix|>///.pipe/docker_engine" ) <|fim_middle|>age docker const ( defaultDockerHost = "npipe:/<|endoftext|>
fim
wagoodman/dive
go
<|fim_suffix|>se "ssh": helper, err := connhelper.GetConnectionHelper(host) if err != nil { return nil, fmt.Errorf("failed to get docker connection helper: %w", err) } clientOpts = append(clientOpts, func(c *client.Client) error { httpClient := &http.Client{ Transport: &http.Transport{ DialContex...
fim
wagoodman/dive
go
<|fim_prefix|>package docker import ( "archive/tar" "bytes" "compress/gzip" "encoding/json" "fmt" "io" "os" "path" "path/filepath" "strings" "github.com/klauspost/compress/zstd" "github.com/wagoodman/dive/dive/filetree" "github.com/wagoodman/dive/dive/image" ) type ImageArchive struct { manifest manif...
fim
wagoodman/dive
go
<|fim_suffix|> result.WastedUserPercent != test.wastedPercent { t.Errorf("%s.%s: expected wastedPercent=%v, got %v", t.Name(), name, test.wastedPercent, result.WastedUserPercent) } if result.Efficiency != test.efficiency { t.Errorf("%s.%s: expected efficiency=%v, got %v", t.Name(), name, test.efficiency, res...
fim
wagoodman/dive
go
<|fim_prefix|>p<|fim_suffix|>return &image.Layer{ Id: id, Index: l.index, Command: strings.TrimPrefix(l.history.CreatedBy, "/bin/sh -c "), Size: l.history.Size, Tree: l.tree, // todo: query docker api for tags Names: []string{"(unavailable)"}, Digest: l.history.ID, } } <|fim_middle|>ackag...
fim
wagoodman/dive
go
<|fim_prefix|>p<|fim_suffix|>to unmarshal manifest: %w", err)) } return manifest[0] } <|fim_middle|>ackage docker import ( "encoding/json" "fmt" ) type manifest struct { ConfigPath string `json:"Config"` RepoTags []string `json:"RepoTags"` LayerTarPaths []string `json:"Layers"` } func newManifest(ma...
fim
wagoodman/dive
go
<|fim_prefix|>package docker import ( "github.com/stretchr/testify/require" "golang.org/x/net/context" "os" "testing" "github.com/wagoodman/dive/dive/image" ) func TestLoadArchi<|fim_suffix|>urn NewImageArchive(f) } func TestAnalysisFromArchive(t testing.TB, path string) *image.Analysis { t.Helper() archive,...
fim
wagoodman/dive
go
<|fim_suffix|>[]*Layer } <|fim_prefix|>package image import ( "github.com/wagoodman/di<|fim_middle|>ve/dive/filetree" ) type Image struct { Request string Trees []*filetree.FileTree Layers <|endoftext|>
fim
wagoodman/dive
go
<|fim_prefix|>package image import ( "fmt" "strings" "github.com/dustin/go-humanize" "github.com/wagoodman/dive/dive/filetree" ) const ( LayerFormat = "%7s %s" ) type Layer struct { Id string Index int Command string Size uint64 Tree *filetre<|fim_suffix|>e Names []string Digest string...
fim
wagoodman/dive
go
<|fim_prefix|>//go:build linux || darwin package podman import ( "os" ) func buildImageFromCli(bu<|fim_suffix|>tring(imageId), nil } <|fim_middle|>ildArgs []string) (string, error) { iidfile, err := os.CreateTemp("/tmp", "dive.*.iid") if err != nil { return "", err } defer os.Remove(iidfile.Name()) defer iid...
fim
wagoodman/dive
go
<|fim_suffix|>aming)") cmd := exec.Command("podman", allArgs...) cmd.Env = os.Environ() reader, writer, err := os.Pipe() if err != nil { return err, nil } defer writer.Close() cmd.Stdout = writer cmd.Stderr = os.Stderr return cmd.Start(), reader } func isPodmanClientBinaryAvailable() bool { _, err := e...
fim
wagoodman/dive
go
<|fim_prefix|>//go:build linux || darwin package podma<|fim_suffix|>first... img, err := r.resolveFromDockerArchive(id) if err == nil { return img, err } return nil, fmt.Errorf("unable to resolve image %q: %+v", id, err) } func (r *resolver) Extract(ctx context.Context, id string, l string, p string) error { ...
fim
wagoodman/dive
go
<|fim_prefix|>//go:build !linux && !darwin // +build !linux,!darwin package podman import ( "context" "fmt" "github.com/wagoodman/dive/dive/image" ) type resolver struct{} func NewResolverFromEngine() *resolver { return &resolv<|fim_suffix|>lay to the user. func (r *resolver) Name() string { return "podman" }...
fim
wagoodman/dive
go
<|fim_prefix|>package image import "golang.org/x/net/context" type Resolver interface { Name() string Fetch(ctx context.Context, id string) (*Image, error) Build(ctx context.Con<|fim_suffix|>ext, options []string) (*Image, error) ContentReader } type ContentReader interface { Extract(ctx context.Context, id str...
fim
wagoodman/dive
go
<|fim_prefix|>packa<|fim_suffix|> } } <|fim_middle|>ge bus import "github.com/wagoodman/go-partybus" var publisher partybus.Publisher func Set(p partybus.Publisher) { publisher = p } func Get() partybus.Publisher { return publisher } func Publish(e partybus.Event) { if publisher != nil { publisher.Publish(e) ...
fim
wagoodman/dive
go
<|fim_prefix|>package event import ( "github.com/wagoodman/go-partybus" ) const ( typePrefix = "dive-cli" // TaskStarted encompasses all events that are related to the analysis of a docker image (build, fetch, analyze) TaskStarted partybus.EventType = typePrefix + "-task-started" // Explore<|fim_suffix|>partyb...
fim
wagoodman/dive
go
<|fim_prefix|>package parser import ( "fmt" "github.com/wagoodman/dive/dive/image" "github.com/wagoodman/dive/internal/bus/event" "github.com/wagoodman/dive/internal/bus/event/payload" "github.com/wagoodman/go-partybus" "github.com/wagoodman/go-progress" ) type ErrBadPayload struct { Type partybus.EventType ...
fim
wagoodman/dive
go
<|fim_prefix|>package p<|fim_suffix|>dive/dive/image" type Explore struct { Analysis image.Analysis Content image.ContentReader } <|fim_middle|>ayload import "github.com/wagoodman/<|endoftext|>
fim
wagoodman/dive
go
<|fim_suffix|>anual } type Title struct { Default string WhileRunning string OnSuccess string } <|fim_prefix|>package payload import ( "context" "github.com/wagoodman/go-progress" ) type genericProgressKey struct{} func SetGenericProgressToContext(ctx context.Context, mon *GenericProgress) context.Cont...
fim
wagoodman/dive
go
<|fim_prefix|>package <|fim_suffix|>goodman/dive/internal/bus/event" "github.com/wagoodman/dive/internal/bus/event/payload" "github.com/wagoodman/go-partybus" "github.com/wagoodman/go-progress" ) func Report(report string) { if len(report) == 0 { return } Publish(partybus.Event{ Type: event.Report, Value:...
fim
wagoodman/dive
go
package log import ( "github.com/anchore/go-logger" "github.com/anchore/go-logger/adapter/discard" ) // log is the singleton used to facilitate logging internally within var log = discard.New() // Set replaces the default logger with the provided logger. func Set(l logger.Logger) { log = l } // Get returns the c...
fim
wagoodman/dive
go
<|fim_suffix|> range s { if str != "" { r = append(r, strings.Trim(str, " ")) } } return r } <|fim_prefix|>package utils import ( "strings" ) // CleanArgs tri<|fim_middle|>ms the whitespace from the given set of strings. func CleanArgs(s []string) []string { var r []string for _, str :=<|endoftext|>
fim
wagoodman/dive
go
<|fim_suffix|>eturn false } if !errors.Is(err, gocui.ErrUnknownView) { log.WithFields("error", err).Error("IsNewView() unexpected error") return true } } return true } <|fim_prefix|>package utils import ( "errors" "github.com/awesome-gocui/gocui" "github.com/wagoodman/dive/internal/log" ) // IsNewVie...
fim
wagoodman/dive
go
<|fim_suffix|>ialogs", link: "/features/dialogs/message" }, { label: "Custom Dialogs", link: "/features/dialogs/custom" }, ], }, { label: "Autostart", collapsed: true, autogenerate: { directory: "features/autostart" }, ...
fim
wailsapp/wails
javascript
<|fim_prefix|>import type { StarlightBlogUserConfig } from "starlight-blog"; type Authors = NonNullable<StarlightBlogUserConfig>["authors"]; export const authors: Authors = { leaanthony: { name: "Lea Anthony"<|fim_suffix|>thony", picture: "https://github.com/leaanthony.png", }, }; <|fim_middle|>, title...
fim
wailsapp/wails
typescript
<|fim_suffix|>s: defineCollection({ loader: docsLoader(), schema: docsSchema({ extend: (context) => blogSchema(context) }), }), }; <|fim_prefix|>im<|fim_middle|>port { defineCollection } from "astro:content"; import { docsLoader, i18nLoader } from "@astrojs/starlight/loaders"; import { docsSchema, i18nSchema ...
fim
wailsapp/wails
typescript