title: Can't get golang pprof working
body: <p>I have tried to profile some golang applications but I couldn't have that working, I have followed these two tutorials: </p>
  
  <ul>
  <li><a href="http://blog.golang.org/profiling-go-programs" rel="noreferrer">http://blog.golang.org/profiling-go-programs</a></li>
  <li><a href="http://saml.rilspace.org/profiling-and-creating-call-graphs-for-go-programs-with-go-tool-pprof" rel="noreferrer">http://saml.rilspace.org/profiling-and-creating-call-graphs-for-go-programs-with-go-tool-pprof</a></li>
  </ul>
  
  <p>Both says that after adding some code lines to the application, you have to execute your app, I did that and I receiveed the following message in the screen:</p>
  
  <blockquote>
    <p>2015/06/16 12:04:00 profile: cpu profiling enabled,
    /var/folders/kg/4fxym1sn0bx02zl_2sdbmrhr9wjvqt/T/profile680799962/cpu.pprof</p>
  </blockquote>
  
  <p>So, I understand that the profiling is being executed, sending info to the file.</p>
  
  <p>But, when I see the file size, in any program that I test, it is always 64bytes.</p>
  
  <p>When I try to open the cpu.pprof file with pprof, and I execute the "top10" command, I see that nothing is in the file:</p>
  
  <p>("./fact" is my app)</p>
  
  <blockquote>
    <p>go tool pprof ./fact
    /var/folders/kg/4fxym1sn0bx02zl_2sdbmrhr9wjvqt/T/profile680799962/cpu.pprof</p>
    
    <p>top10 --></p>
    
    <p>(pprof) top10 0 of 0 total (    0%)
          flat  flat%   sum%        cum   cum%</p>
  </blockquote>
  
  <p>So, it is like nothing is happening when I am profiling.</p>
  
  <p>I have tested it in mac (this example) and in ubuntu, with three different programs.</p>
  
  <p>Do you know that I am doing wrong?</p>
  
  <p>Then example program is very simple, this is the code (is a very simple factorial program that I take from internet):</p>
  
  <pre><code>import "fmt"
  import "github.com/davecheney/profile"
  
  func fact(n int) int {
        if n == 0 {
          return 1
        }
        return n * fact(n-1)
  }
  
  func main() {
        defer profile.Start(profile.CPUProfile).Stop()
        fmt.Println(fact(30))
  }
  </code></pre>
  
  <p>Thanks,
  Fer</p>