Browse Source

etcdserver: clean up code format

Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
Gyuho Lee 7 years ago
parent
commit
51af6a062f

+ 2 - 2
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
 // passwordStore implements PasswordStore using bcrypt to hash user passwords
 type passwordStore struct{}
 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))
 	err := bcrypt.CompareHashAndPassword([]byte(user.Password), []byte(password))
 	return err == nil
 	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)
 	hash, err := bcrypt.GenerateFromPassword([]byte(password), bcrypt.DefaultCost)
 	return string(hash), err
 	return string(hash), err
 }
 }

+ 3 - 3
etcdserver/api/v2auth/auth_test.go

@@ -30,7 +30,7 @@ import (
 
 
 type fakeDoer struct{}
 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
 	return etcdserver.Response{}, nil
 }
 }
 
 
@@ -372,11 +372,11 @@ func TestEnsure(t *testing.T) {
 type fastPasswordStore struct {
 type fastPasswordStore struct {
 }
 }
 
 
-func (_ fastPasswordStore) CheckPassword(user User, password string) bool {
+func (fastPasswordStore) CheckPassword(user User, password string) bool {
 	return user.Password == password
 	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) {
 func TestCreateAndUpdateUser(t *testing.T) {
 	olduser := `{"user": "cat", "roles" : ["animal"]}`
 	olduser := `{"user": "cat", "roles" : ["animal"]}`

+ 1 - 2
etcdserver/api/v2store/store.go

@@ -216,9 +216,8 @@ func (s *store) Set(nodePath string, dir bool, value string, expireOpts TTLOptio
 		if getErr != nil {
 		if getErr != nil {
 			err = getErr
 			err = getErr
 			return nil, err
 			return nil, err
-		} else {
-			value = n.Value
 		}
 		}
+		value = n.Value
 	}
 	}
 
 
 	// Set new value
 	// Set new value