You can go through the file rune by rune, maybe after reading it using
ioutil.ReadFile and converting to
string, keeping track of how many you see of each. A
map[rune]int is useful here. Then copy the keys into a slice of runes (
rune, you’ll need to iterate over the map to do this), sort it by the frequency in the map (the
sort.Slice function is nice here), and print the five first (or last, depending on the sort) items.
(This sounds like homework so I’m giving you useful hints and pointers instead of the answer.)