It may be worth looking at http://golang.org/pkg/time/#ParseDuration.