1
0
mirror of https://github.com/docker/cli.git synced 2026-01-26 15:41:42 +03:00

internal/registryclient: simplify notFoundError

- remove constructor
- fix mixed pointer/non-pointer receivers
- just embed the error we want to produce

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn
2026-01-14 10:55:22 +01:00
parent d61519f99c
commit 816f4556ce

View File

@@ -271,7 +271,7 @@ func (c *client) iterateEndpoints(ctx context.Context, namedRef reference.Named,
return nil
}
}
return newNotFoundError(namedRef.String())
return notFoundError{errors.New("no such manifest: " + namedRef.String())}
}
// allEndpoints returns a list of endpoints ordered by priority (v2, http).
@@ -290,17 +290,6 @@ func allEndpoints(ctx context.Context, namedRef reference.Named, insecure bool)
return endpoints, err
}
func newNotFoundError(ref string) *notFoundError {
return &notFoundError{err: errors.New("no such manifest: " + ref)}
}
type notFoundError struct{ error }
type notFoundError struct {
err error
}
func (n *notFoundError) Error() string {
return n.err.Error()
}
// NotFound satisfies interface github.com/docker/docker/errdefs.ErrNotFound
func (notFoundError) NotFound() {}