From 1a165fd535cdec150c5d5333f42beb0d2f6d0968 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Mon, 3 Mar 2025 15:32:58 +0100 Subject: [PATCH] cli/registry/client: un-export ErrHTTPProto This type was added in 02719bdbb5fb47389e47575bb006509da86df344, but was never used outside of the package itself. This patch un-exports it. Signed-off-by: Sebastiaan van Stijn --- cli/registry/client/client.go | 12 ++++++------ cli/registry/client/fetcher.go | 3 ++- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/cli/registry/client/client.go b/cli/registry/client/client.go index 24b78165d0..31975d483e 100644 --- a/cli/registry/client/client.go +++ b/cli/registry/client/client.go @@ -54,13 +54,13 @@ func (err ErrBlobCreated) Error() string { err.From, err.Target) } -// ErrHTTPProto returned if attempting to use TLS with a non-TLS registry -type ErrHTTPProto struct { - OrigErr string +// httpProtoError returned if attempting to use TLS with a non-TLS registry +type httpProtoError struct { + cause error } -func (err ErrHTTPProto) Error() string { - return err.OrigErr +func (e httpProtoError) Error() string { + return e.cause.Error() } var _ RegistryClient = &client{} @@ -131,7 +131,7 @@ func (c *client) getRepositoryForReference(ctx context.Context, ref reference.Na return nil, err } if !repoEndpoint.endpoint.TLSConfig.InsecureSkipVerify { - return nil, ErrHTTPProto{OrigErr: err.Error()} + return nil, httpProtoError{cause: err} } // --insecure was set; fall back to plain HTTP if url := repoEndpoint.endpoint.URL; url != nil && url.Scheme == "https" { diff --git a/cli/registry/client/fetcher.go b/cli/registry/client/fetcher.go index d1f255bf9f..767d1129ce 100644 --- a/cli/registry/client/fetcher.go +++ b/cli/registry/client/fetcher.go @@ -241,7 +241,8 @@ func (c *client) iterateEndpoints(ctx context.Context, namedRef reference.Named, repo, err := c.getRepositoryForReference(ctx, namedRef, repoEndpoint) if err != nil { logrus.Debugf("error %s with repo endpoint %+v", err, repoEndpoint) - if _, ok := err.(ErrHTTPProto); ok { + var protoErr httpProtoError + if errors.As(err, &protoErr) { continue } return err