How do you time a function in Go and return its runtime in milliseconds?
Perhaps you can also use a Duration (elapsed) for this...looks a little bit nicer.
func trace(s string) (string, time.Time) {
log.Printf("trace start: %s\n", s)
return s, time.Now()
}
func un(s string, startTime time.Time) {
elapsed := time.Since(startTime)
log.Printf("trace end: %s, elapsed %f secs\n", s, elapsed.Seconds())
}