Do not use strings.Compare

According to https://golang.org/src/strings/compare.go?s=491:520#L3
It's suggested to use the built-in string comparison operators.

And also, seems like this function does not exist in some arch
such as arm64. So we better not use it.

Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
This commit is contained in:
Qiang Huang 2015-12-26 13:50:52 +00:00
parent 6028de0dd1
commit a7cc3926dd
1 changed files with 1 additions and 1 deletions

View File

@ -20,7 +20,7 @@ func (r RoleList) Less(i, j int) bool {
segsI := strings.Split(r[i], "/")
segsJ := strings.Split(r[j], "/")
if len(segsI) == len(segsJ) {
return strings.Compare(r[i], r[j]) == -1
return r[i] < r[j]
}
return len(segsI) < len(segsJ)
}