Go gotcha: What happened to ABBA?
What’s up with strings.TrimRight?
TrimRight functions strip all Unicode code points contained in a cutset.
In this case, all trailing A:s and B:s are stripped from the string, leaving the empty string.
To strip a trailing string, use
fmt.Println(strings.TrimSuffix("ABBA", "BA")) // Output: "AB"
See String handling cheat sheet for more about strings in Go.