Files
jira/keyring.go
T
Will Rouesnel 07854d6be5 Handle keyring.ErrNotFound error instead of panicing.
github.com/tmc/keyring returns keyring.ErrNotFound instead of a blank password
in newer libraries. Handle this case properly by nulling the error, to give the
user a chance to set a new password.
2017-08-21 13:24:10 +10:00

18 lines
354 B
Go

// +build !windows
package jira
import "github.com/tmc/keyring"
func keyringGet(user string) (string, error) {
password, err := keyring.Get("go-jira", user)
if err != nil && err != keyring.ErrNotFound {
return password, err
}
return password, nil
}
func keyringSet(user, passwd string) error {
return keyring.Set("go-jira", user, passwd)
}