etcdctl/ctlv3: remove "strings.Compare == 0"

Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
This commit is contained in:
Gyuho Lee 2018-04-30 15:11:11 -07:00
parent e9d5789dd4
commit 86cee93d6b
2 changed files with 4 additions and 4 deletions

View File

@ -189,12 +189,12 @@ func (s *simplePrinter) RoleGet(role string, r v3.AuthRoleGetResponse) {
printRange := func(perm *v3.Permission) {
sKey := string(perm.Key)
sRangeEnd := string(perm.RangeEnd)
if strings.Compare(sRangeEnd, "\x00") != 0 {
if sRangeEnd != "\x00" {
fmt.Printf("\t[%s, %s)", sKey, sRangeEnd)
} else {
fmt.Printf("\t[%s, <open ended>", sKey)
}
if strings.Compare(v3.GetPrefixRangeEnd(sKey), sRangeEnd) == 0 {
if v3.GetPrefixRangeEnd(sKey) == sRangeEnd {
fmt.Printf(" (prefix %s)", sKey)
}
fmt.Printf("\n")
@ -240,7 +240,7 @@ func (s *simplePrinter) RoleRevokePermission(role string, key string, end string
fmt.Printf("Permission of key %s is revoked from role %s\n", key, role)
return
}
if strings.Compare(end, "\x00") != 0 {
if end != "\x00" {
fmt.Printf("Permission of range [%s, %s) is revoked from role %s\n", key, end, role)
} else {
fmt.Printf("Permission of range [%s, <open ended> is revoked from role %s\n", key, role)

View File

@ -272,7 +272,7 @@ func readPasswordInteractive(name string) string {
ExitWithError(ExitBadArgs, fmt.Errorf("failed to ask password: %s.", err2))
}
if strings.Compare(password1, password2) != 0 {
if password1 != password2 {
ExitWithError(ExitBadArgs, fmt.Errorf("given passwords are different."))
}