diff options
Diffstat (limited to 'pkg/domain/entities')
-rw-r--r-- | pkg/domain/entities/container_ps.go | 6 | ||||
-rw-r--r-- | pkg/domain/entities/containers.go | 34 | ||||
-rw-r--r-- | pkg/domain/entities/engine_container.go | 24 | ||||
-rw-r--r-- | pkg/domain/entities/engine_image.go | 14 | ||||
-rw-r--r-- | pkg/domain/entities/filters.go | 24 | ||||
-rw-r--r-- | pkg/domain/entities/images.go | 8 | ||||
-rw-r--r-- | pkg/domain/entities/pods.go | 24 | ||||
-rw-r--r-- | pkg/domain/entities/set.go | 16 | ||||
-rw-r--r-- | pkg/domain/entities/types.go | 4 | ||||
-rw-r--r-- | pkg/domain/entities/volumes.go | 8 |
10 files changed, 81 insertions, 81 deletions
diff --git a/pkg/domain/entities/container_ps.go b/pkg/domain/entities/container_ps.go index fd94d93be..c5e11f188 100644 --- a/pkg/domain/entities/container_ps.go +++ b/pkg/domain/entities/container_ps.go @@ -85,9 +85,9 @@ func (a psSortedCommand) Less(i, j int) bool { return strings.Join(a.SortListContainers[i].Command, " ") < strings.Join(a.SortListContainers[j].Command, " ") } -type psSortedId struct{ SortListContainers } +type psSortedID struct{ SortListContainers } -func (a psSortedId) Less(i, j int) bool { +func (a psSortedID) Less(i, j int) bool { return a.SortListContainers[i].ID < a.SortListContainers[j].ID } @@ -139,7 +139,7 @@ func (a PsSortedCreateTime) Less(i, j int) bool { func SortPsOutput(sortBy string, psOutput SortListContainers) (SortListContainers, error) { switch sortBy { case "id": - sort.Sort(psSortedId{psOutput}) + sort.Sort(psSortedID{psOutput}) case "image": sort.Sort(psSortedImage{psOutput}) case "command": diff --git a/pkg/domain/entities/containers.go b/pkg/domain/entities/containers.go index 2363e6677..b4d8e6c29 100644 --- a/pkg/domain/entities/containers.go +++ b/pkg/domain/entities/containers.go @@ -56,7 +56,7 @@ type WaitOptions struct { } type WaitReport struct { - Id string + Id string //nolint Error error ExitCode int32 } @@ -76,7 +76,7 @@ type PauseUnPauseOptions struct { type PauseUnpauseReport struct { Err error - Id string + Id string //nolint } type StopOptions struct { @@ -89,7 +89,7 @@ type StopOptions struct { type StopReport struct { Err error - Id string + Id string //nolint } type TopOptions struct { @@ -110,7 +110,7 @@ type KillOptions struct { type KillReport struct { Err error - Id string + Id string //nolint } type RestartOptions struct { @@ -122,7 +122,7 @@ type RestartOptions struct { type RestartReport struct { Err error - Id string + Id string //nolint } type RmOptions struct { @@ -137,7 +137,7 @@ type RmOptions struct { type RmReport struct { Err error - Id string + Id string //nolint } type ContainerInspectReport struct { @@ -157,7 +157,7 @@ type CommitOptions struct { } type CommitReport struct { - Id string + Id string //nolint } type ContainerExportOptions struct { @@ -176,7 +176,7 @@ type CheckpointOptions struct { type CheckpointReport struct { Err error - Id string + Id string //nolint } type RestoreOptions struct { @@ -193,11 +193,11 @@ type RestoreOptions struct { type RestoreReport struct { Err error - Id string + Id string //nolint } type ContainerCreateReport struct { - Id string + Id string //nolint } // AttachOptions describes the cli and other values @@ -263,7 +263,7 @@ type ContainerStartOptions struct { // ContainerStartReport describes the response from starting // containers from the cli type ContainerStartReport struct { - Id string + Id string //nolint RawInput string Err error ExitCode int @@ -303,7 +303,7 @@ type ContainerRunOptions struct { // a container type ContainerRunReport struct { ExitCode int - Id string + Id string //nolint } // ContainerCleanupOptions are the CLI values for the @@ -320,7 +320,7 @@ type ContainerCleanupOptions struct { // container cleanup type ContainerCleanupReport struct { CleanErr error - Id string + Id string //nolint RmErr error RmiErr error } @@ -336,7 +336,7 @@ type ContainerInitOptions struct { // container init type ContainerInitReport struct { Err error - Id string + Id string //nolint } //ContainerMountOptions describes the input values for mounting containers @@ -358,7 +358,7 @@ type ContainerUnmountOptions struct { // ContainerMountReport describes the response from container mount type ContainerMountReport struct { Err error - Id string + Id string //nolint Name string Path string } @@ -366,7 +366,7 @@ type ContainerMountReport struct { // ContainerUnmountReport describes the response from umounting a container type ContainerUnmountReport struct { Err error - Id string + Id string //nolint } // ContainerPruneOptions describes the options needed @@ -392,7 +392,7 @@ type ContainerPortOptions struct { // ContainerPortReport describes the output needed for // the CLI to output ports type ContainerPortReport struct { - Id string + Id string //nolint Ports []ocicni.PortMapping } diff --git a/pkg/domain/entities/engine_container.go b/pkg/domain/entities/engine_container.go index 3d5161745..979df7581 100644 --- a/pkg/domain/entities/engine_container.go +++ b/pkg/domain/entities/engine_container.go @@ -12,25 +12,25 @@ import ( type ContainerEngine interface { AutoUpdate(ctx context.Context, options AutoUpdateOptions) (*AutoUpdateReport, []error) Config(ctx context.Context) (*config.Config, error) - ContainerAttach(ctx context.Context, nameOrId string, options AttachOptions) error + ContainerAttach(ctx context.Context, nameOrID string, options AttachOptions) error ContainerCheckpoint(ctx context.Context, namesOrIds []string, options CheckpointOptions) ([]*CheckpointReport, error) ContainerCleanup(ctx context.Context, namesOrIds []string, options ContainerCleanupOptions) ([]*ContainerCleanupReport, error) - ContainerCommit(ctx context.Context, nameOrId string, options CommitOptions) (*CommitReport, error) + ContainerCommit(ctx context.Context, nameOrID string, options CommitOptions) (*CommitReport, error) ContainerCp(ctx context.Context, source, dest string, options ContainerCpOptions) (*ContainerCpReport, error) ContainerCreate(ctx context.Context, s *specgen.SpecGenerator) (*ContainerCreateReport, error) - ContainerDiff(ctx context.Context, nameOrId string, options DiffOptions) (*DiffReport, error) - ContainerExec(ctx context.Context, nameOrId string, options ExecOptions, streams define.AttachStreams) (int, error) + ContainerDiff(ctx context.Context, nameOrID string, options DiffOptions) (*DiffReport, error) + ContainerExec(ctx context.Context, nameOrID string, options ExecOptions, streams define.AttachStreams) (int, error) ContainerExecDetached(ctx context.Context, nameOrID string, options ExecOptions) (string, error) - ContainerExists(ctx context.Context, nameOrId string) (*BoolReport, error) - ContainerExport(ctx context.Context, nameOrId string, options ContainerExportOptions) error + ContainerExists(ctx context.Context, nameOrID string) (*BoolReport, error) + ContainerExport(ctx context.Context, nameOrID string, options ContainerExportOptions) error ContainerInit(ctx context.Context, namesOrIds []string, options ContainerInitOptions) ([]*ContainerInitReport, error) ContainerInspect(ctx context.Context, namesOrIds []string, options InspectOptions) ([]*ContainerInspectReport, error) ContainerKill(ctx context.Context, namesOrIds []string, options KillOptions) ([]*KillReport, error) ContainerList(ctx context.Context, options ContainerListOptions) ([]ListContainer, error) ContainerLogs(ctx context.Context, containers []string, options ContainerLogsOptions) error - ContainerMount(ctx context.Context, nameOrIds []string, options ContainerMountOptions) ([]*ContainerMountReport, error) + ContainerMount(ctx context.Context, nameOrIDs []string, options ContainerMountOptions) ([]*ContainerMountReport, error) ContainerPause(ctx context.Context, namesOrIds []string, options PauseUnPauseOptions) ([]*PauseUnpauseReport, error) - ContainerPort(ctx context.Context, nameOrId string, options ContainerPortOptions) ([]*ContainerPortReport, error) + ContainerPort(ctx context.Context, nameOrID string, options ContainerPortOptions) ([]*ContainerPortReport, error) ContainerPrune(ctx context.Context, options ContainerPruneOptions) (*ContainerPruneReport, error) ContainerRestart(ctx context.Context, namesOrIds []string, options RestartOptions) ([]*RestartReport, error) ContainerRestore(ctx context.Context, namesOrIds []string, options RestoreOptions) ([]*RestoreReport, error) @@ -41,14 +41,14 @@ type ContainerEngine interface { ContainerStats(ctx context.Context, namesOrIds []string, options ContainerStatsOptions) error ContainerStop(ctx context.Context, namesOrIds []string, options StopOptions) ([]*StopReport, error) ContainerTop(ctx context.Context, options TopOptions) (*StringSliceReport, error) - ContainerUnmount(ctx context.Context, nameOrIds []string, options ContainerUnmountOptions) ([]*ContainerUnmountReport, error) + ContainerUnmount(ctx context.Context, nameOrIDs []string, options ContainerUnmountOptions) ([]*ContainerUnmountReport, error) ContainerUnpause(ctx context.Context, namesOrIds []string, options PauseUnPauseOptions) ([]*PauseUnpauseReport, error) ContainerWait(ctx context.Context, namesOrIds []string, options WaitOptions) ([]WaitReport, error) Events(ctx context.Context, opts EventsOptions) error GenerateSystemd(ctx context.Context, nameOrID string, opts GenerateSystemdOptions) (*GenerateSystemdReport, error) GenerateKube(ctx context.Context, nameOrID string, opts GenerateKubeOptions) (*GenerateKubeReport, error) SystemPrune(ctx context.Context, options SystemPruneOptions) (*SystemPruneReport, error) - HealthCheckRun(ctx context.Context, nameOrId string, options HealthCheckOptions) (*define.HealthCheckResults, error) + HealthCheckRun(ctx context.Context, nameOrID string, options HealthCheckOptions) (*define.HealthCheckResults, error) Info(ctx context.Context) (*define.Info, error) NetworkCreate(ctx context.Context, name string, options NetworkCreateOptions) (*NetworkCreateReport, error) NetworkInspect(ctx context.Context, namesOrIds []string, options NetworkInspectOptions) ([]NetworkInspectReport, error) @@ -56,7 +56,7 @@ type ContainerEngine interface { NetworkRm(ctx context.Context, namesOrIds []string, options NetworkRmOptions) ([]*NetworkRmReport, error) PlayKube(ctx context.Context, path string, opts PlayKubeOptions) (*PlayKubeReport, error) PodCreate(ctx context.Context, opts PodCreateOptions) (*PodCreateReport, error) - PodExists(ctx context.Context, nameOrId string) (*BoolReport, error) + PodExists(ctx context.Context, nameOrID string) (*BoolReport, error) PodInspect(ctx context.Context, options PodInspectOptions) (*PodInspectReport, error) PodKill(ctx context.Context, namesOrIds []string, options PodKillOptions) ([]*PodKillReport, error) PodPause(ctx context.Context, namesOrIds []string, options PodPauseOptions) ([]*PodPauseReport, error) @@ -75,7 +75,7 @@ type ContainerEngine interface { Unshare(ctx context.Context, args []string) error VarlinkService(ctx context.Context, opts ServiceOptions) error Version(ctx context.Context) (*SystemVersionReport, error) - VolumeCreate(ctx context.Context, opts VolumeCreateOptions) (*IdOrNameResponse, error) + VolumeCreate(ctx context.Context, opts VolumeCreateOptions) (*IDOrNameResponse, error) VolumeInspect(ctx context.Context, namesOrIds []string, opts VolumeInspectOptions) ([]*VolumeInspectReport, error) VolumeList(ctx context.Context, opts VolumeListOptions) ([]*VolumeListReport, error) VolumePrune(ctx context.Context, opts VolumePruneOptions) ([]*VolumePruneReport, error) diff --git a/pkg/domain/entities/engine_image.go b/pkg/domain/entities/engine_image.go index 7d7099838..60fb20b6e 100644 --- a/pkg/domain/entities/engine_image.go +++ b/pkg/domain/entities/engine_image.go @@ -9,9 +9,9 @@ import ( type ImageEngine interface { Build(ctx context.Context, containerFiles []string, opts BuildOptions) (*BuildReport, error) Config(ctx context.Context) (*config.Config, error) - Diff(ctx context.Context, nameOrId string, options DiffOptions) (*DiffReport, error) - Exists(ctx context.Context, nameOrId string) (*BoolReport, error) - History(ctx context.Context, nameOrId string, opts ImageHistoryOptions) (*ImageHistoryReport, error) + Diff(ctx context.Context, nameOrID string, options DiffOptions) (*DiffReport, error) + Exists(ctx context.Context, nameOrID string) (*BoolReport, error) + History(ctx context.Context, nameOrID string, opts ImageHistoryOptions) (*ImageHistoryReport, error) Import(ctx context.Context, opts ImageImportOptions) (*ImageImportReport, error) Inspect(ctx context.Context, namesOrIDs []string, opts InspectOptions) ([]*ImageInspectReport, error) List(ctx context.Context, opts ImageListOptions) ([]*ImageSummary, error) @@ -20,14 +20,14 @@ type ImageEngine interface { Pull(ctx context.Context, rawImage string, opts ImagePullOptions) (*ImagePullReport, error) Push(ctx context.Context, source string, destination string, opts ImagePushOptions) error Remove(ctx context.Context, images []string, opts ImageRemoveOptions) (*ImageRemoveReport, []error) - Save(ctx context.Context, nameOrId string, tags []string, options ImageSaveOptions) error + Save(ctx context.Context, nameOrID string, tags []string, options ImageSaveOptions) error Search(ctx context.Context, term string, opts ImageSearchOptions) ([]ImageSearchReport, error) SetTrust(ctx context.Context, args []string, options SetTrustOptions) error ShowTrust(ctx context.Context, args []string, options ShowTrustOptions) (*ShowTrustReport, error) Shutdown(ctx context.Context) - Tag(ctx context.Context, nameOrId string, tags []string, options ImageTagOptions) error - Tree(ctx context.Context, nameOrId string, options ImageTreeOptions) (*ImageTreeReport, error) - Untag(ctx context.Context, nameOrId string, tags []string, options ImageUntagOptions) error + Tag(ctx context.Context, nameOrID string, tags []string, options ImageTagOptions) error + Tree(ctx context.Context, nameOrID string, options ImageTreeOptions) (*ImageTreeReport, error) + Untag(ctx context.Context, nameOrID string, tags []string, options ImageUntagOptions) error ManifestCreate(ctx context.Context, names, images []string, opts ManifestCreateOptions) (string, error) ManifestInspect(ctx context.Context, name string) ([]byte, error) ManifestAdd(ctx context.Context, opts ManifestAddOptions) (string, error) diff --git a/pkg/domain/entities/filters.go b/pkg/domain/entities/filters.go index c7e227244..2ddbffbcd 100644 --- a/pkg/domain/entities/filters.go +++ b/pkg/domain/entities/filters.go @@ -20,14 +20,14 @@ type Names interface { Names() []string } -// IdOrName interface allows filters to access ID() or Name() of object -type IdOrNamed interface { +// IDOrName interface allows filters to access ID() or Name() of object +type IDOrNamed interface { Identifier Named } -// IdOrName interface allows filters to access ID() or Names() of object -type IdOrNames interface { +// IDOrName interface allows filters to access ID() or Names() of object +type IDOrNames interface { Identifier Names } @@ -42,11 +42,11 @@ func CompileImageFilters(filters url.Values) ImageFilter { for name, targets := range filters { switch name { case "id": - fns = append(fns, FilterIdFn(targets)) + fns = append(fns, FilterIDFn(targets)) case "name": fns = append(fns, FilterNamesFn(targets)) case "idOrName": - fns = append(fns, FilterIdOrNameFn(targets)) + fns = append(fns, FilterIDOrNameFn(targets)) } } @@ -66,11 +66,11 @@ func CompileContainerFilters(filters url.Values) ContainerFilter { for name, targets := range filters { switch name { case "id": - fns = append(fns, FilterIdFn(targets)) + fns = append(fns, FilterIDFn(targets)) case "name": fns = append(fns, FilterNameFn(targets)) case "idOrName": - fns = append(fns, FilterIdOrNameFn(targets)) + fns = append(fns, FilterIDOrNameFn(targets)) } } @@ -89,7 +89,7 @@ func CompileVolumeFilters(filters url.Values) VolumeFilter { for name, targets := range filters { if name == "id" { - fns = append(fns, FilterIdFn(targets)) + fns = append(fns, FilterIDFn(targets)) } } @@ -103,7 +103,7 @@ func CompileVolumeFilters(filters url.Values) VolumeFilter { } } -func FilterIdFn(id []string) func(Identifier) bool { +func FilterIDFn(id []string) func(Identifier) bool { return func(obj Identifier) bool { for _, v := range id { if strings.Contains(obj.Id(), v) { @@ -138,8 +138,8 @@ func FilterNamesFn(name []string) func(Names) bool { } } -func FilterIdOrNameFn(id []string) func(IdOrNamed) bool { - return func(obj IdOrNamed) bool { +func FilterIDOrNameFn(id []string) func(IDOrNamed) bool { + return func(obj IDOrNamed) bool { for _, v := range id { if strings.Contains(obj.Id(), v) || strings.Contains(obj.Name(), v) { return true diff --git a/pkg/domain/entities/images.go b/pkg/domain/entities/images.go index 5bb110b57..81f52fef5 100644 --- a/pkg/domain/entities/images.go +++ b/pkg/domain/entities/images.go @@ -45,13 +45,13 @@ type Image struct { HealthCheck *manifest.Schema2HealthConfig `json:",omitempty"` } -func (i *Image) Id() string { +func (i *Image) Id() string { //nolint return i.ID } type ImageSummary struct { ID string `json:"Id"` - ParentId string `json:",omitempty"` + ParentId string `json:",omitempty"` // nolint RepoTags []string `json:",omitempty"` Created time.Time `json:",omitempty"` Size int64 `json:",omitempty"` @@ -70,7 +70,7 @@ type ImageSummary struct { History []string `json:",omitempty"` } -func (i *ImageSummary) Id() string { +func (i *ImageSummary) Id() string { //nolint return i.ID } @@ -266,7 +266,7 @@ type ImageImportOptions struct { } type ImageImportReport struct { - Id string + Id string //nolint } type ImageSaveOptions struct { diff --git a/pkg/domain/entities/pods.go b/pkg/domain/entities/pods.go index 37acba6e6..a85333c75 100644 --- a/pkg/domain/entities/pods.go +++ b/pkg/domain/entities/pods.go @@ -17,15 +17,15 @@ type PodKillOptions struct { type PodKillReport struct { Errs []error - Id string + Id string //nolint } type ListPodsReport struct { Cgroup string Containers []*ListPodContainer Created time.Time - Id string - InfraId string + Id string //nolint + InfraId string //nolint Name string Namespace string Status string @@ -33,7 +33,7 @@ type ListPodsReport struct { } type ListPodContainer struct { - Id string + Id string //nolint Names string Status string } @@ -45,7 +45,7 @@ type PodPauseOptions struct { type PodPauseReport struct { Errs []error - Id string + Id string //nolint } type PodunpauseOptions struct { @@ -55,7 +55,7 @@ type PodunpauseOptions struct { type PodUnpauseReport struct { Errs []error - Id string + Id string //nolint } type PodStopOptions struct { @@ -67,7 +67,7 @@ type PodStopOptions struct { type PodStopReport struct { Errs []error - Id string + Id string //nolint } type PodRestartOptions struct { @@ -77,7 +77,7 @@ type PodRestartOptions struct { type PodRestartReport struct { Errs []error - Id string + Id string //nolint } type PodStartOptions struct { @@ -87,7 +87,7 @@ type PodStartOptions struct { type PodStartReport struct { Errs []error - Id string + Id string //nolint } type PodRmOptions struct { @@ -99,7 +99,7 @@ type PodRmOptions struct { type PodRmReport struct { Err error - Id string + Id string //nolint } type PodCreateOptions struct { @@ -115,7 +115,7 @@ type PodCreateOptions struct { } type PodCreateReport struct { - Id string + Id string //nolint } func (p PodCreateOptions) ToPodSpecGen(s *specgen.PodSpecGenerator) { @@ -155,7 +155,7 @@ type PodPruneOptions struct { type PodPruneReport struct { Err error - Id string + Id string //nolint } type PodTopOptions struct { diff --git a/pkg/domain/entities/set.go b/pkg/domain/entities/set.go index c8d6cb1a9..1d31d82f9 100644 --- a/pkg/domain/entities/set.go +++ b/pkg/domain/entities/set.go @@ -4,12 +4,12 @@ import ( "strings" ) -type stringSet struct { +type StringSet struct { m map[string]struct{} } -func NewStringSet(elem ...string) *stringSet { - s := &stringSet{} +func NewStringSet(elem ...string) *StringSet { + s := &StringSet{} s.m = make(map[string]struct{}, len(elem)) for _, e := range elem { s.Add(e) @@ -17,20 +17,20 @@ func NewStringSet(elem ...string) *stringSet { return s } -func (s *stringSet) Add(elem string) { +func (s *StringSet) Add(elem string) { s.m[elem] = struct{}{} } -func (s *stringSet) Remove(elem string) { +func (s *StringSet) Remove(elem string) { delete(s.m, elem) } -func (s *stringSet) Contains(elem string) bool { +func (s *StringSet) Contains(elem string) bool { _, ok := s.m[elem] return ok } -func (s *stringSet) Elements() []string { +func (s *StringSet) Elements() []string { keys := make([]string, len(s.m)) i := 0 for k := range s.m { @@ -40,6 +40,6 @@ func (s *stringSet) Elements() []string { return keys } -func (s *stringSet) String() string { +func (s *StringSet) String() string { return strings.Join(s.Elements(), ", ") } diff --git a/pkg/domain/entities/types.go b/pkg/domain/entities/types.go index 21ab025de..622f74838 100644 --- a/pkg/domain/entities/types.go +++ b/pkg/domain/entities/types.go @@ -11,7 +11,7 @@ import ( ) type Container struct { - IdOrNamed + IDOrNamed } type Volume struct { @@ -19,7 +19,7 @@ type Volume struct { } type Report struct { - Id []string + Id []string //nolint Err map[string]error } diff --git a/pkg/domain/entities/volumes.go b/pkg/domain/entities/volumes.go index 23c066083..7cf7d82a2 100644 --- a/pkg/domain/entities/volumes.go +++ b/pkg/domain/entities/volumes.go @@ -16,9 +16,9 @@ type VolumeCreateOptions struct { Options map[string]string `schema:"opts"` } -type IdOrNameResponse struct { +type IDOrNameResponse struct { // The Id or Name of an object - IdOrName string + IDOrName string } type VolumeConfigResponse struct { @@ -63,7 +63,7 @@ type VolumeRmOptions struct { type VolumeRmReport struct { Err error - Id string + Id string //nolint } type VolumeInspectOptions struct { @@ -80,7 +80,7 @@ type VolumePruneOptions struct { type VolumePruneReport struct { Err error - Id string + Id string //nolint } type VolumeListOptions struct { |