Skip to content

Commit 66369fc

Browse files
committed
lint: fix deprecated
1 parent a530bfb commit 66369fc

File tree

4 files changed

+17
-19
lines changed

4 files changed

+17
-19
lines changed

internal/provider/docker/container.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ func (c *Client) listContainerImage() []model.Image {
4343
var list []model.Image
4444
for _, ctn := range ctns {
4545
imageName := ctn.Image
46-
imageRaw, err := cli.ImageInspectWithRaw(imageName)
46+
imageInfo, err := cli.ImageInspect(imageName)
4747
if err != nil {
4848
c.logger.Error().Err(err).
4949
Str("ctn_id", ctn.ID).
@@ -52,15 +52,15 @@ func (c *Client) listContainerImage() []model.Image {
5252
continue
5353
}
5454

55-
if local := cli.IsLocalImage(imageRaw); local {
55+
if local := cli.IsLocalImage(imageInfo); local {
5656
c.logger.Debug().
5757
Str("ctn_id", ctn.ID).
5858
Str("ctn_image", imageName).
5959
Msg("Skip locally built image")
6060
continue
6161
}
6262

63-
if dangling := cli.IsDanglingImage(imageRaw); dangling {
63+
if dangling := cli.IsDanglingImage(imageInfo); dangling {
6464
c.logger.Debug().
6565
Str("ctn_id", ctn.ID).
6666
Str("ctn_image", imageName).
@@ -69,18 +69,18 @@ func (c *Client) listContainerImage() []model.Image {
6969
}
7070

7171
if cli.IsDigest(imageName) {
72-
if len(imageRaw.RepoDigests) > 0 {
72+
if len(imageInfo.RepoDigests) > 0 {
7373
c.logger.Debug().
7474
Str("ctn_id", ctn.ID).
7575
Str("ctn_image", imageName).
76-
Strs("img_repodigests", imageRaw.RepoDigests).
76+
Strs("img_repodigests", imageInfo.RepoDigests).
7777
Msg("Using first image repo digest available as image name")
78-
imageName = imageRaw.RepoDigests[0]
78+
imageName = imageInfo.RepoDigests[0]
7979
} else {
8080
c.logger.Debug().
8181
Str("ctn_id", ctn.ID).
8282
Str("ctn_image", imageName).
83-
Strs("img_repodigests", imageRaw.RepoDigests).
83+
Strs("img_repodigests", imageInfo.RepoDigests).
8484
Msg("Skip unknown image digest ref")
8585
continue
8686
}

pkg/docker/container.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,12 @@ package docker
33
import (
44
"sort"
55

6-
"github.com/docker/docker/api/types"
76
"github.com/docker/docker/api/types/container"
87
"github.com/docker/docker/api/types/filters"
98
)
109

1110
// ContainerList returns Docker containers
12-
func (c *Client) ContainerList(filterArgs filters.Args) ([]types.Container, error) {
11+
func (c *Client) ContainerList(filterArgs filters.Args) ([]container.Summary, error) {
1312
containers, err := c.API.ContainerList(c.ctx, container.ListOptions{
1413
Filters: filterArgs,
1514
})

pkg/docker/image.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@ package docker
33
import (
44
"regexp"
55

6-
"github.com/docker/docker/api/types"
6+
"github.com/docker/docker/api/types/container"
7+
"github.com/docker/docker/api/types/image"
78
)
89

910
// ContainerInspect returns the container information.
10-
func (c *Client) ContainerInspect(containerID string) (types.ContainerJSON, error) {
11+
func (c *Client) ContainerInspect(containerID string) (container.InspectResponse, error) {
1112
return c.API.ContainerInspect(c.ctx, containerID)
1213
}
1314

@@ -16,20 +17,19 @@ func (c *Client) IsDigest(imageID string) bool {
1617
return regexp.MustCompile(`^(@|sha256:|@sha256:)([0-9a-f]{64})$`).MatchString(imageID)
1718
}
1819

19-
// ImageInspectWithRaw returns the image information and its raw representation.
20-
func (c *Client) ImageInspectWithRaw(imageID string) (types.ImageInspect, error) {
21-
imageRaw, _, err := c.API.ImageInspectWithRaw(c.ctx, imageID)
22-
return imageRaw, err
20+
// ImageInspect returns the image information.
21+
func (c *Client) ImageInspect(imageID string) (image.InspectResponse, error) {
22+
return c.API.ImageInspect(c.ctx, imageID)
2323
}
2424

2525
// IsLocalImage checks if the image has been built locally
26-
func (c *Client) IsLocalImage(image types.ImageInspect) bool {
26+
func (c *Client) IsLocalImage(image image.InspectResponse) bool {
2727
return len(image.RepoDigests) == 0
2828
}
2929

3030
// IsDanglingImage returns whether the given image is "dangling" which means
3131
// that there are no repository references to the given image and it has no
3232
// child images
33-
func (c *Client) IsDanglingImage(image types.ImageInspect) bool {
33+
func (c *Client) IsDanglingImage(image image.InspectResponse) bool {
3434
return len(image.RepoTags) == 1 && image.RepoTags[0] == "<none>:<none>" && len(image.RepoDigests) == 1 && image.RepoDigests[0] == "<none>@<none>"
3535
}

pkg/docker/service.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,13 @@ package docker
33
import (
44
"sort"
55

6-
"github.com/docker/docker/api/types"
76
"github.com/docker/docker/api/types/filters"
87
"github.com/docker/docker/api/types/swarm"
98
)
109

1110
// ServiceList returns Swarm services
1211
func (c *Client) ServiceList(filterArgs filters.Args) ([]swarm.Service, error) {
13-
services, err := c.API.ServiceList(c.ctx, types.ServiceListOptions{
12+
services, err := c.API.ServiceList(c.ctx, swarm.ServiceListOptions{
1413
Filters: filterArgs,
1514
})
1615
if err != nil {

0 commit comments

Comments
 (0)