Refactor anagram in Go