Skip to content

Commit 12ccbea

Browse files
committed
remove unused method references
Signed-off-by: Oleksandr Krutko <[email protected]>
1 parent b18dccc commit 12ccbea

File tree

2 files changed

+9
-38
lines changed

2 files changed

+9
-38
lines changed

pkg/domain/entities/types/container_ps.go

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -118,31 +118,3 @@ func (l ListContainer) USERNS() string {
118118
func (l ListContainer) UTS() string {
119119
return l.Namespaces.UTS
120120
}
121-
122-
func (l ListContainer) Commands() []string {
123-
return l.Command
124-
}
125-
126-
func (l ListContainer) ContainerID() string {
127-
return l.ID
128-
}
129-
130-
func (l ListContainer) LabelsList() map[string]string {
131-
return l.Labels
132-
}
133-
134-
func (l ListContainer) NamesList() []string {
135-
return l.Names
136-
}
137-
138-
func (l ListContainer) ImageInfo() (string, string) {
139-
return l.ImageID, l.Image
140-
}
141-
142-
func (l ListContainer) CreatedTime() time.Time {
143-
return l.Created
144-
}
145-
146-
func (l ListContainer) StatusInfo() string {
147-
return l.Status
148-
}

pkg/domain/filters/containers.go

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -327,12 +327,12 @@ func GenerateExternalContainerFilterFuncs(filter string, filterValues []string,
327327
switch filter {
328328
case "id":
329329
return func(listContainer *types.ListContainer) bool {
330-
return filters.FilterID(listContainer.ContainerID(), filterValues)
330+
return filters.FilterID(listContainer.ID, filterValues)
331331
}, nil
332332
case "name":
333333
// we only have to match one name
334334
return func(listContainer *types.ListContainer) bool {
335-
namesList := listContainer.NamesList()
335+
namesList := listContainer.Names
336336

337337
for _, f := range filterValues {
338338
f = strings.ReplaceAll(f, "/", "")
@@ -345,26 +345,25 @@ func GenerateExternalContainerFilterFuncs(filter string, filterValues []string,
345345
}, nil
346346
case "command":
347347
return func(listContainer *types.ListContainer) bool {
348-
return util.StringMatchRegexSlice(listContainer.Commands()[0], filterValues)
348+
return util.StringMatchRegexSlice(listContainer.Command[0], filterValues)
349349
}, nil
350350
case "ancestor":
351351
// This needs to refine to match docker
352352
// - ancestor=(<image-name>[:tag]|<image-id>| ⟨image@digest⟩) - containers created from an image or a descendant.
353353
return func(listContainer *types.ListContainer) bool {
354354
for _, filterValue := range filterValues {
355-
rootfsImageID, rootfsImageName := listContainer.ImageInfo()
356355
var imageTag string
357356
var imageNameWithoutTag string
358357
// Compare with ImageID, ImageName
359358
// Will match ImageName if running image has tag latest for other tags exact complete filter must be given
360-
name, tag, hasColon := strings.Cut(rootfsImageName, ":")
359+
name, tag, hasColon := strings.Cut(listContainer.Image, ":")
361360
if hasColon {
362361
imageNameWithoutTag = name
363362
imageTag = tag
364363
}
365364

366-
if (rootfsImageID == filterValue) ||
367-
util.StringMatchRegexSlice(rootfsImageName, filterValues) ||
365+
if (listContainer.ImageID == filterValue) ||
366+
util.StringMatchRegexSlice(listContainer.Image, filterValues) ||
368367
(util.StringMatchRegexSlice(imageNameWithoutTag, filterValues) && imageTag == "latest") {
369368
return true
370369
}
@@ -390,7 +389,7 @@ func GenerateExternalContainerFilterFuncs(filter string, filterValues []string,
390389
}
391390

392391
return func(listContainer *types.ListContainer) bool {
393-
return createTime.After(listContainer.CreatedTime())
392+
return createTime.After(listContainer.Created)
394393
}, nil
395394
case "since":
396395
var createTime time.Time
@@ -411,15 +410,15 @@ func GenerateExternalContainerFilterFuncs(filter string, filterValues []string,
411410
}
412411

413412
return func(listContainer *types.ListContainer) bool {
414-
return createTime.Before(listContainer.CreatedTime())
413+
return createTime.Before(listContainer.Created)
415414
}, nil
416415
case "until":
417416
until, err := filters.ComputeUntilTimestamp(filterValues)
418417
if err != nil {
419418
return nil, err
420419
}
421420
return func(listContainer *types.ListContainer) bool {
422-
if !until.IsZero() && listContainer.CreatedTime().Before(until) {
421+
if !until.IsZero() && listContainer.Created.Before(until) {
423422
return true
424423
}
425424
return false

0 commit comments

Comments
 (0)