Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ggcr: "func (w wrapper) Resolve" ignores errors #1878

Open
cedricvanrompay-datadog opened this issue Feb 19, 2024 · 0 comments
Open

ggcr: "func (w wrapper) Resolve" ignores errors #1878

cedricvanrompay-datadog opened this issue Feb 19, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@cedricvanrompay-datadog

The return type of func (w wrapper) Resolve(r Resource) is (Authenticator, error) but in practice it will never return a non-nil error.

Even when the call to w.h.Get(r.RegistryStr()) returns an error, Resolve return an anonymous authenticator with a nil error.

This is a problem as it does not give a way for the caller to differentiate between the case where it is supposed to use an anonymous authentication and the case where an error happened when reaching out to the registry.

If this kind of behavior cannot be avoided (typically, for some registries one cannot distinguish between the need to use anonymous authentication and an error happening when reaching out to the registry), then it should at least be clearly documented in the type Keychain interface that the Resolve function can return Anonymous, nil when there was an error resolving.

This way, callers who know they are not supposed to use anonymous credentials can check for Anonymous, nil and not just err != nil.

@cedricvanrompay-datadog cedricvanrompay-datadog added the bug Something isn't working label Feb 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant