API behavior between backends (may not be) consistent
- Vorherrschende Sprache
- Go
- Sterne
- 657
- Forks
- 155
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
Example on first-use of an application:
- The macos keychain backend will return an empty list and nil error the first time Keys() (or Get()) is called:
```sh
2019/06/01 07:11:51 [keyring] Considering backends: [keychain pass file]
2019/06/01 07:11:51 [keyring] Querying keychain for service="vault", keychain=""
2019/06/01 07:11:51 [keyring] Found 0 results
$ echo $?
0
```
- The libsecret backend will return a secretError with message that the keychain does not exist:
```sh
2019/06/01 07:13:25 [keyring] Considering backends: [secret-service kwallet pass file]
Error: Failed to read tokens from backend storage: The collection "vault" does not exist. Please add a key first
$ echo $?
255
```
The returned error is a generic type `secretError` and so I could handle this by wrapping keyring.List() and checking err.Error() contains the string "Please add a key first", but I am wondering what the expected behavior is for the library itself and if perhaps libsecret should be modified to not return an err if the collection does not yet exist?
I haven't checked the other backend types for how they handle first-use of Get and Keys yet.
Beitragsleitfaden
Für dieses Repository ist kein Beitragsleitfaden indexiert
Bewertung
Dieses Issue wurde noch nicht bewertet.