strings.EqualFold uses Unicode case folding, not case mapping. Case
folding is only one-to-one character transformations. Converting "ss"
to "ß" is case mapping, and as such is not used by strings.EqualFold.
For that, you want the x/text/search package, as in
package main
import (
"fmt"
"
golang.org/x/text/language"
"
golang.org/x/text/search"
)
func main() {
m := search.New(language.German, search.Loose)
s1 := "der Fluß"
s2 := "der Fluss"
fmt.Println(m.EqualString(s1, s2))
}
That should print true.
An example where strings.EqualFold does not return the same result as
strings.ToLower(s1) == strings.ToLower(s2) is
s1 := "σς"
s2 := "ΣΣ"
strings.EqualFold will return true but comparing the ToLower of the
strings will return false. This is because there are two lower case
forms of Σ (depending on position in the word), but strings.ToLower
can of course only return one.
Ian