diff --git a/etcdserver/api/v2auth/auth.go b/etcdserver/api/v2auth/auth.go index 70a74e1b1..c828323c4 100644 --- a/etcdserver/api/v2auth/auth.go +++ b/etcdserver/api/v2auth/auth.go @@ -160,12 +160,12 @@ func NewStore(lg *zap.Logger, server doer, timeout time.Duration) Store { // passwordStore implements PasswordStore using bcrypt to hash user passwords type passwordStore struct{} -func (_ passwordStore) CheckPassword(user User, password string) bool { +func (passwordStore) CheckPassword(user User, password string) bool { err := bcrypt.CompareHashAndPassword([]byte(user.Password), []byte(password)) return err == nil } -func (_ passwordStore) HashPassword(password string) (string, error) { +func (passwordStore) HashPassword(password string) (string, error) { hash, err := bcrypt.GenerateFromPassword([]byte(password), bcrypt.DefaultCost) return string(hash), err } diff --git a/etcdserver/api/v2auth/auth_test.go b/etcdserver/api/v2auth/auth_test.go index 2171bda8a..43bce1a9c 100644 --- a/etcdserver/api/v2auth/auth_test.go +++ b/etcdserver/api/v2auth/auth_test.go @@ -30,7 +30,7 @@ import ( type fakeDoer struct{} -func (_ fakeDoer) Do(context.Context, etcdserverpb.Request) (etcdserver.Response, error) { +func (fakeDoer) Do(context.Context, etcdserverpb.Request) (etcdserver.Response, error) { return etcdserver.Response{}, nil } @@ -372,11 +372,11 @@ func TestEnsure(t *testing.T) { type fastPasswordStore struct { } -func (_ fastPasswordStore) CheckPassword(user User, password string) bool { +func (fastPasswordStore) CheckPassword(user User, password string) bool { return user.Password == password } -func (_ fastPasswordStore) HashPassword(password string) (string, error) { return password, nil } +func (fastPasswordStore) HashPassword(password string) (string, error) { return password, nil } func TestCreateAndUpdateUser(t *testing.T) { olduser := `{"user": "cat", "roles" : ["animal"]}` diff --git a/etcdserver/api/v2store/store.go b/etcdserver/api/v2store/store.go index e6d0f32d0..65cc8559c 100644 --- a/etcdserver/api/v2store/store.go +++ b/etcdserver/api/v2store/store.go @@ -216,9 +216,8 @@ func (s *store) Set(nodePath string, dir bool, value string, expireOpts TTLOptio if getErr != nil { err = getErr return nil, err - } else { - value = n.Value } + value = n.Value } // Set new value