TrimRight无法正常工作

Below is the code of TrimRight, on latest Go version

I am observing a behavior, which maybe I am misunderstanding but as my understanding, the below code should throw output as

Hello

But the output is coming as

Hell

Why is that so ? Note, I have kept a space before the Gophers in cutset, so fundamentally it should remove the " Gophers" from the primary string, leaving behind just Hello

package main

import (
    "fmt"
    "strings"
)

func main() {
    result := strings.TrimRight("Hello Gophers", " Gophers")

    fmt.Println(result, len(result))
}

As documented, TrimRight removes all matching characters from the right. Because o is included in your list (" Gophers"), it is also trimmed. If you want to trim that exact substring use TrimSuffix instead.