This could be more elegant if go supports currying.  i don't know