chore(deps): bump go/stdlib to v1.23.x and update go modules

- Upgraded `go.mod` to use Go 1.23 and updated module dependencies to latest versions
- Refactored code to align with API changes in Docker and related modules:
  - Updated `ContainerListOptions` to `container.ListOptions` and related structs
  - Replaced `types.ImageDeleteResponseItem` with `image.DeleteResponse` for compatibility
  - Modified `ImagePullOptions` and `ContainerRemoveOptions` to updated package paths
This commit is contained in:
nemezo 2024-10-31 14:27:34 +01:00
parent 76f9cea516
commit e0cbe337d7
No known key found for this signature in database
GPG key ID: FC41783B3CB4CCE8
9 changed files with 216 additions and 169 deletions

View file

@ -10,6 +10,7 @@ import (
"github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/container"
"github.com/docker/docker/api/types/filters"
"github.com/docker/docker/api/types/image"
"github.com/docker/docker/api/types/network"
sdkClient "github.com/docker/docker/client"
log "github.com/sirupsen/logrus"
@ -109,7 +110,7 @@ func (client dockerClient) ListContainers(fn t.Filter) ([]t.Container, error) {
filter := client.createListFilter()
containers, err := client.api.ContainerList(
bg,
types.ContainerListOptions{
container.ListOptions{
Filters: filter,
})
@ -206,7 +207,7 @@ func (client dockerClient) StopContainer(c t.Container, timeout time.Duration) e
} else {
log.Debugf("Removing container %s", shortID)
if err := client.api.ContainerRemove(bg, idStr, types.ContainerRemoveOptions{Force: true, RemoveVolumes: client.RemoveVolumes}); err != nil {
if err := client.api.ContainerRemove(bg, idStr, container.RemoveOptions{Force: true, RemoveVolumes: client.RemoveVolumes}); err != nil {
if sdkClient.IsErrNotFound(err) {
log.Debugf("Container %s not found, skipping removal.", shortID)
return nil
@ -303,7 +304,7 @@ func (client dockerClient) doStartContainer(bg context.Context, c t.Container, c
name := c.Name()
log.Debugf("Starting container %s (%s)", name, t.ContainerID(creation.ID).ShortID())
err := client.api.ContainerStart(bg, creation.ID, types.ContainerStartOptions{})
err := client.api.ContainerStart(bg, creation.ID, container.StartOptions{})
if err != nil {
return err
}
@ -411,7 +412,7 @@ func (client dockerClient) RemoveImageByID(id t.ImageID) error {
items, err := client.api.ImageRemove(
context.Background(),
string(id),
types.ImageRemoveOptions{
image.RemoveOptions{
Force: true,
})