Skip to content

Commit dba2caf

Browse files
committed
Leverage slices.Contains
1 parent 63d5f38 commit dba2caf

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

server/authentication_handler.go

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package server
22

33
import (
4+
"slices"
45
"sync"
56

67
"github.com/go-mysql-org/go-mysql/mysql"
@@ -70,12 +71,7 @@ func (c Credential) HashPassword(password string) (string, error) {
7071

7172
// HasEmptyPassword returns true if any password in the credential is empty.
7273
func (c Credential) HasEmptyPassword() bool {
73-
for _, p := range c.Passwords {
74-
if p == "" {
75-
return true
76-
}
77-
}
78-
return false
74+
return slices.Contains(c.Passwords, "")
7975
}
8076

8177
// InMemoryAuthenticationHandler implements AuthenticationHandler with in-memory credential storage.

0 commit comments

Comments
 (0)