From 3276580fbd4fee42943011f4d5bf4012070e85f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miloslav=20Trma=C4=8D?= Date: Mon, 18 Aug 2025 19:48:29 +0200 Subject: [PATCH 1/4] Update to Go 1.25 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Miloslav Trmač --- go.mod | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/go.mod b/go.mod index ae74155c5..539e0c85c 100644 --- a/go.mod +++ b/go.mod @@ -1,9 +1,7 @@ module github.com/containers/skopeo // Minimum required golang version -go 1.24.6 - -toolchain go1.24.10 +go 1.25.0 // Warning: Ensure the "go" and "toolchain" versions match exactly to prevent unwanted auto-updates From c49d55b2a48c44ddd678a71b42341a208522f8ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miloslav=20Trma=C4=8D?= Date: Mon, 18 Aug 2025 19:51:08 +0200 Subject: [PATCH 2/4] Use WaitGroup.Go MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Should not change behavior. Signed-off-by: Miloslav Trmač --- cmd/skopeo/proxy.go | 13 ++++--------- integration/proxy_test.go | 12 ++++-------- 2 files changed, 8 insertions(+), 17 deletions(-) diff --git a/cmd/skopeo/proxy.go b/cmd/skopeo/proxy.go index c3992c5e1..bdbc67af6 100644 --- a/cmd/skopeo/proxy.go +++ b/cmd/skopeo/proxy.go @@ -332,7 +332,6 @@ func (h *proxyHandler) allocPipe() (*os.File, *activePipe, error) { w: pipew, } h.activePipes[uint32(pipew.Fd())] = &f - f.wg.Add(1) return piper, &f, nil } @@ -345,14 +344,12 @@ func (h *proxyHandler) returnBytes(retval any, buf []byte) (replyBuf, error) { return ret, err } - go func() { - // Signal completion when we return - defer f.wg.Done() + f.wg.Go(func() { _, err = io.Copy(f.w, bytes.NewReader(buf)) if err != nil { f.err = err } - }() + }) ret.value = retval ret.fd = piper @@ -583,10 +580,8 @@ func (h *proxyHandler) GetBlob(args []any) (replyBuf, error) { blobr.Close() return ret, err } - go func() { - // Signal completion when we return + f.wg.Go(func() { defer blobr.Close() - defer f.wg.Done() verifier := d.Verifier() tr := io.TeeReader(blobr, verifier) n, err := io.Copy(f.w, tr) @@ -600,7 +595,7 @@ func (h *proxyHandler) GetBlob(args []any) (replyBuf, error) { if !verifier.Verified() { f.err = fmt.Errorf("corrupted blob, expecting %s", d.String()) } - }() + }) ret.value = blobSize ret.fd = piper diff --git a/integration/proxy_test.go b/integration/proxy_test.go index d86c9b145..067575f6a 100644 --- a/integration/proxy_test.go +++ b/integration/proxy_test.go @@ -214,9 +214,7 @@ func (p *proxy) callGetRawBlob(args []any) (rval any, buf []byte, err error) { var wg sync.WaitGroup fetchchan := make(chan byteFetch, 1) errchan := make(chan proxyError, 1) - wg.Add(1) - go func() { - defer wg.Done() + wg.Go(func() { defer close(fetchchan) defer fd.datafd.Close() buf, err := io.ReadAll(fd.datafd) @@ -224,10 +222,8 @@ func (p *proxy) callGetRawBlob(args []any) (rval any, buf []byte, err error) { content: buf, err: err, } - }() - wg.Add(1) - go func() { - defer wg.Done() + }) + wg.Go(func() { defer fd.errfd.Close() defer close(errchan) buf, err := io.ReadAll(fd.errfd) @@ -248,7 +244,7 @@ func (p *proxy) callGetRawBlob(args []any) (rval any, buf []byte, err error) { panic(unmarshalErr) } errchan <- proxyErr - }() + }) wg.Wait() errMsg := <-errchan From 8b9f757eb16310228e2589fb12c0b1ac656f98b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miloslav=20Trma=C4=8D?= Date: Mon, 18 Aug 2025 19:51:29 +0200 Subject: [PATCH 3/4] Use "any" instead of "interface{}" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Should not change behavior. Signed-off-by: Miloslav Trmač --- integration/proxy_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/integration/proxy_test.go b/integration/proxy_test.go index 067575f6a..586035e6d 100644 --- a/integration/proxy_test.go +++ b/integration/proxy_test.go @@ -384,7 +384,7 @@ func runTestMetadataAPIs(p *proxy, img string) error { if err != nil { return err } - var layerInfoBytesData []interface{} + var layerInfoBytesData []any err = json.Unmarshal(layerInfoBytes, &layerInfoBytesData) if err != nil { return err From 33ea6c63a1ca49482573ea8b28f1360990ddd151 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miloslav=20Trma=C4=8D?= Date: Wed, 11 Mar 2026 18:27:15 +0100 Subject: [PATCH 4/4] Use fmt.Appendf instead of Sprintf + conversion MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Should not change behavior. Signed-off-by: Miloslav Trmač --- integration/tls_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/integration/tls_test.go b/integration/tls_test.go index 59946fe03..3edcbfdb4 100644 --- a/integration/tls_test.go +++ b/integration/tls_test.go @@ -243,7 +243,7 @@ func (s *tlsSuite) TestOpenShift() { t.Setenv("KUBECONFIG", configPath) for _, e := range s.expected { - err := os.WriteFile(configPath, []byte(fmt.Sprintf( + err := os.WriteFile(configPath, fmt.Appendf(nil, `apiVersion: v1 clusters: - cluster: @@ -257,7 +257,7 @@ contexts: name: our-context current-context: our-context kind: Config -`, e.server.certPath, e.server.server.URL)), 0o644) +`, e.server.certPath, e.server.server.URL), 0o644) require.NoError(t, err) // The atomic: image access starts with resolving the tag in a k8s API (and that will always fail, one way or another), // so we never actually contact registry.example.