Dan Buch 0d7806fba4 Re-namespacing things and adjusting how stuff gets built
based on some recent practical experience with Go.
2012-11-05 20:36:27 -05:00

20 lines
305 B
Go

package main
import (
"strings"
"code.google.com/p/go-tour/wc"
)
func WordCount(s string) map[string]int {
counts := make(map[string]int)
words := strings.Fields(s)
for _, word := range words {
counts[word]++
}
return counts
}
func main() {
wc.Test(WordCount)
}