strings.Compare
GO-C4012As per Go's official doc, it is recommended not
to use strings.Compare
. Here's the reason why it is not recommended:
Compare is included only for symmetry with package bytes. It is usually clearer and always faster to use the built-in string comparison operators ==, <, >, and so on.
if strings.Compare(x, y) == 0 {
}
if strings.Compare(x, y) < 0 {
}
if x == y {
}
if x < y {
}