Package's godoc example starts the CPU profiling and defers pprof.StopCPUProfile, but it fails to document that the function need to spend sometime before returning in order for any samples to be collected. We might want to add a time.Sleep to make it more obvious and document it throughly that time is required to collect samples.
if err := pprof.StartCPUProfile(f); err != nil {
log.Fatal("could not start CPU profile: ", err)
}
defer pprof.StopCPUProfile()