1
0
mirror of https://github.com/docker/docker-credential-helpers.git synced 2026-06-13 16:01:28 +05:30

pass: Get: remove redundant stat

listPassdir already handles "not found" errors, in which case it returns
an [empty result][1]. Previously this would return a custom error, but
since 1bb9aa3210, an empty result produces
a `errCredentialsNotFound`, making this check redundant.

This patch removes the redundant check.

[1]: https://github.com/docker/docker-credential-helpers/blob/f64d6b131b3da07a6337dc63a882e08ce541d1c1/pass/pass.go#L118-L125

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn
2024-05-10 10:28:57 +02:00
parent 74840b3740
commit a14669f4ff
-9
View File
@@ -142,15 +142,6 @@ func (p Pass) Get(serverURL string) (string, string, error) {
} }
encoded := encodeServerURL(serverURL) encoded := encodeServerURL(serverURL)
if _, err := os.Stat(path.Join(getPassDir(), PASS_FOLDER, encoded)); err != nil {
if os.IsNotExist(err) {
return "", "", credentials.NewErrCredentialsNotFound()
}
return "", "", err
}
usernames, err := listPassDir(encoded) usernames, err := listPassDir(encoded)
if err != nil { if err != nil {
return "", "", err return "", "", err