mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
etcdctl/ctlv3: remove "strings.Compare == 0"
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
This commit is contained in:
parent
e9d5789dd4
commit
86cee93d6b
@ -189,12 +189,12 @@ func (s *simplePrinter) RoleGet(role string, r v3.AuthRoleGetResponse) {
|
|||||||
printRange := func(perm *v3.Permission) {
|
printRange := func(perm *v3.Permission) {
|
||||||
sKey := string(perm.Key)
|
sKey := string(perm.Key)
|
||||||
sRangeEnd := string(perm.RangeEnd)
|
sRangeEnd := string(perm.RangeEnd)
|
||||||
if strings.Compare(sRangeEnd, "\x00") != 0 {
|
if sRangeEnd != "\x00" {
|
||||||
fmt.Printf("\t[%s, %s)", sKey, sRangeEnd)
|
fmt.Printf("\t[%s, %s)", sKey, sRangeEnd)
|
||||||
} else {
|
} else {
|
||||||
fmt.Printf("\t[%s, <open ended>", sKey)
|
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(" (prefix %s)", sKey)
|
||||||
}
|
}
|
||||||
fmt.Printf("\n")
|
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)
|
fmt.Printf("Permission of key %s is revoked from role %s\n", key, role)
|
||||||
return
|
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)
|
fmt.Printf("Permission of range [%s, %s) is revoked from role %s\n", key, end, role)
|
||||||
} else {
|
} else {
|
||||||
fmt.Printf("Permission of range [%s, <open ended> is revoked from role %s\n", key, role)
|
fmt.Printf("Permission of range [%s, <open ended> is revoked from role %s\n", key, role)
|
||||||
|
@ -272,7 +272,7 @@ func readPasswordInteractive(name string) string {
|
|||||||
ExitWithError(ExitBadArgs, fmt.Errorf("failed to ask password: %s.", err2))
|
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."))
|
ExitWithError(ExitBadArgs, fmt.Errorf("given passwords are different."))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user