From 033c0944430815fd66838172b84130f5351a3464 Mon Sep 17 00:00:00 2001 From: "Jorge Alberto Diaz Orozco (Akiel)" Date: Wed, 24 Apr 2024 18:05:25 +0200 Subject: [PATCH 1/2] Update docker library to v26.1.0 and replace deprecated types with the new ones --- docker.go | 6 +++--- go.mod | 5 +++-- go.sum | 6 ++++-- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/docker.go b/docker.go index 55146c0..1f4e54f 100644 --- a/docker.go +++ b/docker.go @@ -7,6 +7,7 @@ import ( "encoding/json" "errors" "fmt" + "github.com/docker/docker/api/types/image" "github.com/docker/docker/api/types/registry" "io" "log" @@ -14,7 +15,6 @@ import ( "os" "strings" - "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/filters" "github.com/docker/docker/client" docker "github.com/fsouza/go-dockerclient" @@ -43,7 +43,7 @@ func PullImage(imageid string) error { panic(err) } authStr := base64.URLEncoding.EncodeToString(encodedJSON) - out, err := dockerClient.ImagePull(ctx, imageid, types.ImagePullOptions{RegistryAuth: authStr}) + out, err := dockerClient.ImagePull(ctx, imageid, image.PullOptions{RegistryAuth: authStr}) if err != nil { return err } @@ -115,7 +115,7 @@ func ImageExists(imageid string) (bool, error) { if err != nil { return false, err } - imgs, err := dockerClient.ImageList(ctx, types.ImageListOptions{ + imgs, err := dockerClient.ImageList(ctx, image.ListOptions{ All: false, Filters: filters.Args{}, }) diff --git a/go.mod b/go.mod index 8729d3d..6a2adc3 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/jadolg/DockerImageSave -go 1.21 +go 1.22 require ( github.com/InVisionApp/tabular v0.3.0 @@ -8,7 +8,7 @@ require ( github.com/cavaliergopher/grab/v3 v3.0.1 github.com/cespare/xxhash/v2 v2.2.0 // indirect github.com/containerd/containerd v1.7.11 // indirect - github.com/docker/docker v25.0.5+incompatible + github.com/docker/docker v26.1.0+incompatible github.com/dustin/go-humanize v1.0.1 github.com/fatih/color v1.15.0 // indirect github.com/fsouza/go-dockerclient v1.11.0 @@ -41,6 +41,7 @@ require ( github.com/klauspost/compress v1.17.0 // indirect github.com/kr/text v0.2.0 // indirect github.com/mattn/go-isatty v0.0.19 // indirect + github.com/moby/docker-image-spec v1.3.1 // indirect github.com/moby/patternmatcher v0.6.0 // indirect github.com/moby/sys/sequential v0.5.0 // indirect github.com/moby/sys/user v0.1.0 // indirect diff --git a/go.sum b/go.sum index 4c06504..831ca12 100644 --- a/go.sum +++ b/go.sum @@ -30,8 +30,8 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/distribution/reference v0.5.0 h1:/FUIFXtfc/x2gpa5/VGfiGLuOIdYa1t65IKK2OFGvA0= github.com/distribution/reference v0.5.0/go.mod h1:BbU0aIcezP1/5jX/8MP0YiH4SdvB5Y4f/wlDRiLyi3E= -github.com/docker/docker v25.0.5+incompatible h1:UmQydMduGkrD5nQde1mecF/YnSbTOaPeFIeP5C4W+DE= -github.com/docker/docker v25.0.5+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= +github.com/docker/docker v26.1.0+incompatible h1:W1G9MPNbskA6VZWL7b3ZljTh0pXI68FpINx0GKaOdaM= +github.com/docker/docker v26.1.0+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ= github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec= github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4= @@ -74,6 +74,8 @@ github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovk github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA= github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= +github.com/moby/docker-image-spec v1.3.1 h1:jMKff3w6PgbfSa69GfNg+zN/XLhfXJGnEx3Nl2EsFP0= +github.com/moby/docker-image-spec v1.3.1/go.mod h1:eKmb5VW8vQEh/BAr2yvVNvuiJuY6UIocYsFu/DxxRpo= github.com/moby/patternmatcher v0.6.0 h1:GmP9lR19aU5GqSSFko+5pRqHi+Ohk1O69aFiKkVGiPk= github.com/moby/patternmatcher v0.6.0/go.mod h1:hDPoyOpDY7OrrMDLaYoY3hf52gNCR/YOUYxkhApJIxc= github.com/moby/sys/sequential v0.5.0 h1:OPvI35Lzn9K04PBbCLW0g4LcFAJgHsvXsRyewg5lXtc= From b745e174c07aef65828509bbfc490d9acdb9fd82 Mon Sep 17 00:00:00 2001 From: "Jorge Alberto Diaz Orozco (Akiel)" Date: Wed, 24 Apr 2024 18:12:42 +0200 Subject: [PATCH 2/2] Add toolchain to go mod --- go.mod | 2 ++ 1 file changed, 2 insertions(+) diff --git a/go.mod b/go.mod index 6a2adc3..7efb499 100644 --- a/go.mod +++ b/go.mod @@ -2,6 +2,8 @@ module github.com/jadolg/DockerImageSave go 1.22 +toolchain go1.22.2 + require ( github.com/InVisionApp/tabular v0.3.0 github.com/briandowns/spinner v1.23.0