diff --git a/pkg/commands/container.go b/pkg/commands/container.go index d4e00609..2f985e5a 100644 --- a/pkg/commands/container.go +++ b/pkg/commands/container.go @@ -6,9 +6,9 @@ import ( "os/exec" "strings" - "github.com/go-errors/errors" "github.com/christophe-duc/lazypodman/pkg/i18n" "github.com/christophe-duc/lazypodman/pkg/utils" + "github.com/go-errors/errors" "github.com/sasha-s/go-deadlock" "github.com/sirupsen/logrus" "golang.org/x/xerrors" diff --git a/pkg/commands/image.go b/pkg/commands/image.go index a72d63d7..4804f986 100644 --- a/pkg/commands/image.go +++ b/pkg/commands/image.go @@ -4,8 +4,8 @@ import ( "context" "strings" - "github.com/fatih/color" "github.com/christophe-duc/lazypodman/pkg/utils" + "github.com/fatih/color" "github.com/samber/lo" "github.com/sirupsen/logrus" ) diff --git a/pkg/commands/os.go b/pkg/commands/os.go index dec65e18..7d01431c 100644 --- a/pkg/commands/os.go +++ b/pkg/commands/os.go @@ -13,9 +13,9 @@ import ( "github.com/go-errors/errors" - "github.com/jesseduffield/kill" "github.com/christophe-duc/lazypodman/pkg/config" "github.com/christophe-duc/lazypodman/pkg/utils" + "github.com/jesseduffield/kill" "github.com/mgutz/str" "github.com/sirupsen/logrus" ) diff --git a/pkg/commands/podman.go b/pkg/commands/podman.go index 7db51a82..7d1da7ee 100644 --- a/pkg/commands/podman.go +++ b/pkg/commands/podman.go @@ -12,11 +12,11 @@ import ( "sync" "time" - "github.com/imdario/mergo" "github.com/christophe-duc/lazypodman/pkg/commands/ssh" "github.com/christophe-duc/lazypodman/pkg/config" "github.com/christophe-duc/lazypodman/pkg/i18n" "github.com/christophe-duc/lazypodman/pkg/utils" + "github.com/imdario/mergo" "github.com/sasha-s/go-deadlock" "github.com/sirupsen/logrus" ) @@ -27,15 +27,15 @@ const ( // PodmanCommand is our main podman interface type PodmanCommand struct { - Log *logrus.Entry - OSCommand *OSCommand - Tr *i18n.TranslationSet - Config *config.AppConfig - Runtime ContainerRuntime + Log *logrus.Entry + OSCommand *OSCommand + Tr *i18n.TranslationSet + Config *config.AppConfig + Runtime ContainerRuntime InComposeProject bool - ErrorChan chan error - ContainerMutex deadlock.Mutex - ServiceMutex deadlock.Mutex + ErrorChan chan error + ContainerMutex deadlock.Mutex + ServiceMutex deadlock.Mutex Closers []io.Closer } @@ -110,9 +110,9 @@ func NewPodmanCommand(log *logrus.Entry, osCommand *OSCommand, tr *i18n.Translat } podmanCommand := &PodmanCommand{ - Log: log, - OSCommand: osCommand, - Tr: tr, + Log: log, + OSCommand: osCommand, + Tr: tr, Config: config, Runtime: runtime, ErrorChan: errorChan, diff --git a/pkg/commands/runtime_libpod.go b/pkg/commands/runtime_libpod.go index a92b17c5..dffd7ead 100644 --- a/pkg/commands/runtime_libpod.go +++ b/pkg/commands/runtime_libpod.go @@ -516,8 +516,8 @@ func convertLibpodContainerStats(stats *define.ContainerStats) ContainerStatsEnt func convertLibpodImageList(ctx context.Context, imgs []*libimage.Image) []ImageSummary { result := make([]ImageSummary, len(imgs)) for i, img := range imgs { - size, _ := img.Size() // Ignore error for list view - labels, _ := img.Labels(ctx) // Ignore error for list view + size, _ := img.Size() // Ignore error for list view + labels, _ := img.Labels(ctx) // Ignore error for list view result[i] = ImageSummary{ ID: img.ID(), RepoTags: img.Names(), diff --git a/pkg/commands/runtime_mock.go b/pkg/commands/runtime_mock.go index f4037562..16fb8b66 100644 --- a/pkg/commands/runtime_mock.go +++ b/pkg/commands/runtime_mock.go @@ -10,34 +10,34 @@ import ( // If a function is not set, the method returns sensible defaults or errors. type MockRuntime struct { // Container operation mocks - ListContainersFunc func(ctx context.Context) ([]ContainerSummary, error) - InspectContainerFunc func(ctx context.Context, id string) (*ContainerDetails, error) - StartContainerFunc func(ctx context.Context, id string) error - StopContainerFunc func(ctx context.Context, id string, timeout *int) error - PauseContainerFunc func(ctx context.Context, id string) error - UnpauseContainerFunc func(ctx context.Context, id string) error - RestartContainerFunc func(ctx context.Context, id string, timeout *int) error - RemoveContainerFunc func(ctx context.Context, id string, force bool, volumes bool) error - ContainerTopFunc func(ctx context.Context, id string) ([]string, [][]string, error) - PruneContainersFunc func(ctx context.Context) error - ContainerStatsFunc func(ctx context.Context, id string, stream bool) (<-chan ContainerStatsEntry, <-chan error) + ListContainersFunc func(ctx context.Context) ([]ContainerSummary, error) + InspectContainerFunc func(ctx context.Context, id string) (*ContainerDetails, error) + StartContainerFunc func(ctx context.Context, id string) error + StopContainerFunc func(ctx context.Context, id string, timeout *int) error + PauseContainerFunc func(ctx context.Context, id string) error + UnpauseContainerFunc func(ctx context.Context, id string) error + RestartContainerFunc func(ctx context.Context, id string, timeout *int) error + RemoveContainerFunc func(ctx context.Context, id string, force bool, volumes bool) error + ContainerTopFunc func(ctx context.Context, id string) ([]string, [][]string, error) + PruneContainersFunc func(ctx context.Context) error + ContainerStatsFunc func(ctx context.Context, id string, stream bool) (<-chan ContainerStatsEntry, <-chan error) // Image operation mocks - ListImagesFunc func(ctx context.Context) ([]ImageSummary, error) - InspectImageFunc func(ctx context.Context, id string) (*ImageDetails, error) - ImageHistoryFunc func(ctx context.Context, id string) ([]ImageHistoryEntry, error) - RemoveImageFunc func(ctx context.Context, id string, force bool) error - PruneImagesFunc func(ctx context.Context) error + ListImagesFunc func(ctx context.Context) ([]ImageSummary, error) + InspectImageFunc func(ctx context.Context, id string) (*ImageDetails, error) + ImageHistoryFunc func(ctx context.Context, id string) ([]ImageHistoryEntry, error) + RemoveImageFunc func(ctx context.Context, id string, force bool) error + PruneImagesFunc func(ctx context.Context) error // Volume operation mocks - ListVolumesFunc func(ctx context.Context) ([]VolumeSummary, error) - RemoveVolumeFunc func(ctx context.Context, name string, force bool) error - PruneVolumesFunc func(ctx context.Context) error + ListVolumesFunc func(ctx context.Context) ([]VolumeSummary, error) + RemoveVolumeFunc func(ctx context.Context, name string, force bool) error + PruneVolumesFunc func(ctx context.Context) error // Network operation mocks - ListNetworksFunc func(ctx context.Context) ([]NetworkSummary, error) - RemoveNetworkFunc func(ctx context.Context, name string) error - PruneNetworksFunc func(ctx context.Context) error + ListNetworksFunc func(ctx context.Context) ([]NetworkSummary, error) + RemoveNetworkFunc func(ctx context.Context, name string) error + PruneNetworksFunc func(ctx context.Context) error // Pod operation mocks ListPodsFunc func(ctx context.Context) ([]PodSummary, error) diff --git a/pkg/commands/runtime_socket.go b/pkg/commands/runtime_socket.go index dc01d1be..cf100aa8 100644 --- a/pkg/commands/runtime_socket.go +++ b/pkg/commands/runtime_socket.go @@ -7,6 +7,7 @@ import ( "time" "github.com/containers/podman/v5/libpod/define" + handlertypes "github.com/containers/podman/v5/pkg/api/handlers/types" "github.com/containers/podman/v5/pkg/bindings" "github.com/containers/podman/v5/pkg/bindings/containers" "github.com/containers/podman/v5/pkg/bindings/images" @@ -16,7 +17,6 @@ import ( "github.com/containers/podman/v5/pkg/bindings/volumes" "github.com/containers/podman/v5/pkg/domain/entities" "github.com/containers/podman/v5/pkg/domain/entities/types" - handlertypes "github.com/containers/podman/v5/pkg/api/handlers/types" nettypes "go.podman.io/common/libnetwork/types" ) @@ -520,17 +520,17 @@ func convertPodmanImageInspect(data *entities.ImageInspectReport) *ImageDetails } details := &ImageDetails{ - ID: data.ID, - RepoTags: data.RepoTags, - RepoDigests: data.RepoDigests, - Parent: data.Parent, - Comment: data.Comment, - Created: *data.Created, - Author: data.Author, - Architecture: data.Architecture, - Os: data.Os, - Size: data.Size, - VirtualSize: data.VirtualSize, + ID: data.ID, + RepoTags: data.RepoTags, + RepoDigests: data.RepoDigests, + Parent: data.Parent, + Comment: data.Comment, + Created: *data.Created, + Author: data.Author, + Architecture: data.Architecture, + Os: data.Os, + Size: data.Size, + VirtualSize: data.VirtualSize, } if data.RootFS != nil { diff --git a/pkg/commands/runtime_types.go b/pkg/commands/runtime_types.go index 6eba677e..e0167fbb 100644 --- a/pkg/commands/runtime_types.go +++ b/pkg/commands/runtime_types.go @@ -90,27 +90,27 @@ type HealthLog struct { // ContainerConfig represents container configuration. type ContainerConfig struct { - Hostname string - Domainname string - User string - AttachStdin bool - AttachStdout bool - AttachStderr bool - ExposedPorts map[string]struct{} - Tty bool - OpenStdin bool - StdinOnce bool - Env []string - Cmd []string - Image string - Volumes map[string]struct{} - WorkingDir string - Entrypoint []string - OnBuild []string - Labels map[string]string - StopSignal string - StopTimeout *int - Shell []string + Hostname string + Domainname string + User string + AttachStdin bool + AttachStdout bool + AttachStderr bool + ExposedPorts map[string]struct{} + Tty bool + OpenStdin bool + StdinOnce bool + Env []string + Cmd []string + Image string + Volumes map[string]struct{} + WorkingDir string + Entrypoint []string + OnBuild []string + Labels map[string]string + StopSignal string + StopTimeout *int + Shell []string } // NetworkSettings represents container network settings. @@ -304,23 +304,23 @@ type ImageSummary struct { // ImageDetails provides full image inspection data. type ImageDetails struct { - ID string - RepoTags []string - RepoDigests []string - Parent string - Comment string - Created time.Time - Container string - DockerVersion string - Author string - Config *ContainerConfig - Architecture string - Os string - OsVersion string - Size int64 - VirtualSize int64 - RootFS RootFS - Metadata ImageMetadata + ID string + RepoTags []string + RepoDigests []string + Parent string + Comment string + Created time.Time + Container string + DockerVersion string + Author string + Config *ContainerConfig + Architecture string + Os string + OsVersion string + Size int64 + VirtualSize int64 + RootFS RootFS + Metadata ImageMetadata } // RootFS represents the root filesystem of an image. diff --git a/pkg/commands/runtime_types_test.go b/pkg/commands/runtime_types_test.go index ad84bea1..ab654e82 100644 --- a/pkg/commands/runtime_types_test.go +++ b/pkg/commands/runtime_types_test.go @@ -71,15 +71,15 @@ func TestContainerDetailsFields(t *testing.T) { Image: "alpine:latest", ImageID: "sha256:abc123", Config: &ContainerConfig{ - Hostname: "myhost", - User: "root", - Tty: true, - Env: []string{"PATH=/usr/bin"}, - Cmd: []string{"sleep", "infinity"}, - WorkingDir: "/app", - Entrypoint: []string{"/entrypoint.sh"}, - Labels: map[string]string{"version": "1.0"}, - StopSignal: "SIGTERM", + Hostname: "myhost", + User: "root", + Tty: true, + Env: []string{"PATH=/usr/bin"}, + Cmd: []string{"sleep", "infinity"}, + WorkingDir: "/app", + Entrypoint: []string{"/entrypoint.sh"}, + Labels: map[string]string{"version": "1.0"}, + StopSignal: "SIGTERM", }, NetworkSettings: &NetworkSettings{ Bridge: "bridge0", diff --git a/pkg/gui/app_status_manager.go b/pkg/gui/app_status_manager.go index 6b73227b..c06098ed 100644 --- a/pkg/gui/app_status_manager.go +++ b/pkg/gui/app_status_manager.go @@ -3,8 +3,8 @@ package gui import ( "time" - "github.com/jesseduffield/gocui" "github.com/christophe-duc/lazypodman/pkg/utils" + "github.com/jesseduffield/gocui" ) type appStatus struct { diff --git a/pkg/gui/arrangement.go b/pkg/gui/arrangement.go index 735d20b5..bb2bdcdd 100644 --- a/pkg/gui/arrangement.go +++ b/pkg/gui/arrangement.go @@ -1,9 +1,9 @@ package gui import ( - "github.com/jesseduffield/lazycore/pkg/boxlayout" "github.com/christophe-duc/lazypodman/pkg/gui/panels" "github.com/christophe-duc/lazypodman/pkg/utils" + "github.com/jesseduffield/lazycore/pkg/boxlayout" "github.com/mattn/go-runewidth" "github.com/samber/lo" ) diff --git a/pkg/gui/container_logs.go b/pkg/gui/container_logs.go index 9115d436..ad19fa8a 100644 --- a/pkg/gui/container_logs.go +++ b/pkg/gui/container_logs.go @@ -8,10 +8,10 @@ import ( "os/signal" "time" - "github.com/fatih/color" "github.com/christophe-duc/lazypodman/pkg/commands" "github.com/christophe-duc/lazypodman/pkg/tasks" "github.com/christophe-duc/lazypodman/pkg/utils" + "github.com/fatih/color" ) func (gui *Gui) renderContainerLogsToMain(container *commands.Container) tasks.TaskFunc { diff --git a/pkg/gui/containers_panel.go b/pkg/gui/containers_panel.go index 9a42fc82..6131ecf4 100644 --- a/pkg/gui/containers_panel.go +++ b/pkg/gui/containers_panel.go @@ -6,8 +6,6 @@ import ( "strings" "time" - "github.com/fatih/color" - "github.com/jesseduffield/gocui" "github.com/christophe-duc/lazypodman/pkg/commands" "github.com/christophe-duc/lazypodman/pkg/config" "github.com/christophe-duc/lazypodman/pkg/gui/panels" @@ -15,6 +13,8 @@ import ( "github.com/christophe-duc/lazypodman/pkg/gui/types" "github.com/christophe-duc/lazypodman/pkg/tasks" "github.com/christophe-duc/lazypodman/pkg/utils" + "github.com/fatih/color" + "github.com/jesseduffield/gocui" "github.com/samber/lo" ) diff --git a/pkg/gui/custom_commands.go b/pkg/gui/custom_commands.go index 3498378d..d1197177 100644 --- a/pkg/gui/custom_commands.go +++ b/pkg/gui/custom_commands.go @@ -1,11 +1,11 @@ package gui import ( - "github.com/fatih/color" "github.com/christophe-duc/lazypodman/pkg/commands" "github.com/christophe-duc/lazypodman/pkg/config" "github.com/christophe-duc/lazypodman/pkg/gui/types" "github.com/christophe-duc/lazypodman/pkg/utils" + "github.com/fatih/color" "github.com/samber/lo" ) diff --git a/pkg/gui/gocui.go b/pkg/gui/gocui.go index 69181460..de31c15e 100644 --- a/pkg/gui/gocui.go +++ b/pkg/gui/gocui.go @@ -1,9 +1,9 @@ package gui import ( + "github.com/christophe-duc/lazypodman/pkg/utils" "github.com/gookit/color" "github.com/jesseduffield/gocui" - "github.com/christophe-duc/lazypodman/pkg/utils" ) var gocuiColorMap = map[string]gocui.Attribute{ diff --git a/pkg/gui/gui.go b/pkg/gui/gui.go index d6e0711b..6867abda 100644 --- a/pkg/gui/gui.go +++ b/pkg/gui/gui.go @@ -9,14 +9,14 @@ import ( "github.com/go-errors/errors" throttle "github.com/boz/go-throttle" - "github.com/jesseduffield/gocui" - lcUtils "github.com/jesseduffield/lazycore/pkg/utils" "github.com/christophe-duc/lazypodman/pkg/commands" "github.com/christophe-duc/lazypodman/pkg/config" "github.com/christophe-duc/lazypodman/pkg/gui/panels" "github.com/christophe-duc/lazypodman/pkg/gui/types" "github.com/christophe-duc/lazypodman/pkg/i18n" "github.com/christophe-duc/lazypodman/pkg/tasks" + "github.com/jesseduffield/gocui" + lcUtils "github.com/jesseduffield/lazycore/pkg/utils" "github.com/sasha-s/go-deadlock" "github.com/sirupsen/logrus" ) diff --git a/pkg/gui/images_panel.go b/pkg/gui/images_panel.go index e475eade..5d7faaa7 100644 --- a/pkg/gui/images_panel.go +++ b/pkg/gui/images_panel.go @@ -5,8 +5,6 @@ import ( "strings" "time" - "github.com/fatih/color" - "github.com/jesseduffield/gocui" "github.com/christophe-duc/lazypodman/pkg/commands" "github.com/christophe-duc/lazypodman/pkg/config" "github.com/christophe-duc/lazypodman/pkg/gui/panels" @@ -14,6 +12,8 @@ import ( "github.com/christophe-duc/lazypodman/pkg/gui/types" "github.com/christophe-duc/lazypodman/pkg/tasks" "github.com/christophe-duc/lazypodman/pkg/utils" + "github.com/fatih/color" + "github.com/jesseduffield/gocui" "github.com/samber/lo" ) diff --git a/pkg/gui/networks_panel.go b/pkg/gui/networks_panel.go index a2f58ed0..b60a4941 100644 --- a/pkg/gui/networks_panel.go +++ b/pkg/gui/networks_panel.go @@ -3,8 +3,6 @@ package gui import ( "strconv" - "github.com/fatih/color" - "github.com/jesseduffield/gocui" "github.com/christophe-duc/lazypodman/pkg/commands" "github.com/christophe-duc/lazypodman/pkg/config" "github.com/christophe-duc/lazypodman/pkg/gui/panels" @@ -12,6 +10,8 @@ import ( "github.com/christophe-duc/lazypodman/pkg/gui/types" "github.com/christophe-duc/lazypodman/pkg/tasks" "github.com/christophe-duc/lazypodman/pkg/utils" + "github.com/fatih/color" + "github.com/jesseduffield/gocui" "github.com/samber/lo" ) diff --git a/pkg/gui/options_menu_panel.go b/pkg/gui/options_menu_panel.go index 8412c95e..b3afe08e 100644 --- a/pkg/gui/options_menu_panel.go +++ b/pkg/gui/options_menu_panel.go @@ -3,8 +3,8 @@ package gui import ( "github.com/samber/lo" - "github.com/jesseduffield/gocui" "github.com/christophe-duc/lazypodman/pkg/gui/types" + "github.com/jesseduffield/gocui" ) func (gui *Gui) getBindings(v *gocui.View) []*Binding { diff --git a/pkg/gui/panels/side_list_panel.go b/pkg/gui/panels/side_list_panel.go index 7e9c8e68..88377f9b 100644 --- a/pkg/gui/panels/side_list_panel.go +++ b/pkg/gui/panels/side_list_panel.go @@ -5,10 +5,10 @@ import ( "fmt" "strings" - "github.com/go-errors/errors" - "github.com/jesseduffield/gocui" "github.com/christophe-duc/lazypodman/pkg/tasks" "github.com/christophe-duc/lazypodman/pkg/utils" + "github.com/go-errors/errors" + "github.com/jesseduffield/gocui" "github.com/samber/lo" ) diff --git a/pkg/gui/project_panel.go b/pkg/gui/project_panel.go index dd7e8cf8..21345cfb 100644 --- a/pkg/gui/project_panel.go +++ b/pkg/gui/project_panel.go @@ -6,13 +6,13 @@ import ( "path" "strings" - "github.com/fatih/color" - "github.com/jesseduffield/gocui" "github.com/christophe-duc/lazypodman/pkg/commands" "github.com/christophe-duc/lazypodman/pkg/gui/panels" "github.com/christophe-duc/lazypodman/pkg/gui/presentation" "github.com/christophe-duc/lazypodman/pkg/tasks" "github.com/christophe-duc/lazypodman/pkg/utils" + "github.com/fatih/color" + "github.com/jesseduffield/gocui" "github.com/jesseduffield/yaml" ) diff --git a/pkg/gui/services_panel.go b/pkg/gui/services_panel.go index 3afbf383..fa81e54d 100644 --- a/pkg/gui/services_panel.go +++ b/pkg/gui/services_panel.go @@ -5,8 +5,6 @@ import ( "fmt" "time" - "github.com/fatih/color" - "github.com/jesseduffield/gocui" "github.com/christophe-duc/lazypodman/pkg/commands" "github.com/christophe-duc/lazypodman/pkg/config" "github.com/christophe-duc/lazypodman/pkg/gui/panels" @@ -14,6 +12,8 @@ import ( "github.com/christophe-duc/lazypodman/pkg/gui/types" "github.com/christophe-duc/lazypodman/pkg/tasks" "github.com/christophe-duc/lazypodman/pkg/utils" + "github.com/fatih/color" + "github.com/jesseduffield/gocui" "github.com/samber/lo" ) diff --git a/pkg/gui/subprocess.go b/pkg/gui/subprocess.go index b2c02e77..9691955c 100644 --- a/pkg/gui/subprocess.go +++ b/pkg/gui/subprocess.go @@ -8,8 +8,8 @@ import ( "os/signal" "strings" - "github.com/fatih/color" "github.com/christophe-duc/lazypodman/pkg/utils" + "github.com/fatih/color" ) func (gui *Gui) runSubprocess(cmd *exec.Cmd) error { diff --git a/pkg/gui/view_helpers.go b/pkg/gui/view_helpers.go index 5024e4ec..674b3cf1 100644 --- a/pkg/gui/view_helpers.go +++ b/pkg/gui/view_helpers.go @@ -5,9 +5,9 @@ import ( "sort" "strings" - "github.com/jesseduffield/gocui" "github.com/christophe-duc/lazypodman/pkg/gui/panels" "github.com/christophe-duc/lazypodman/pkg/utils" + "github.com/jesseduffield/gocui" "github.com/samber/lo" "github.com/spkg/bom" ) diff --git a/pkg/gui/volumes_panel.go b/pkg/gui/volumes_panel.go index 81ceb489..1e865746 100644 --- a/pkg/gui/volumes_panel.go +++ b/pkg/gui/volumes_panel.go @@ -3,8 +3,6 @@ package gui import ( "fmt" - "github.com/fatih/color" - "github.com/jesseduffield/gocui" "github.com/christophe-duc/lazypodman/pkg/commands" "github.com/christophe-duc/lazypodman/pkg/config" "github.com/christophe-duc/lazypodman/pkg/gui/panels" @@ -12,6 +10,8 @@ import ( "github.com/christophe-duc/lazypodman/pkg/gui/types" "github.com/christophe-duc/lazypodman/pkg/tasks" "github.com/christophe-duc/lazypodman/pkg/utils" + "github.com/fatih/color" + "github.com/jesseduffield/gocui" "github.com/samber/lo" )