I'm trying to resolve the puzzle from go tour #43 and I don't understand why my word counter doesn't work. "print" seems to print the expected value but the tests sees only "1" regardless the count.
package main
import (
"code.google.com/p/go-tour/wc"
"strings"
"unicode/utf8"
)
func WordCount(s string) map[string]int {
// explode the string into a slice without whitespaces
ws := strings.Fields(s)
//make a new map
c := make(map[string]int)
//iterate over each word
for _, v := range ws{
c[v] = utf8.RuneCountInString(v)
}
print( c["am"])
return c
}
func main() {
wc.Test(WordCount)
}