title: How do you get a Golang program to print the line number of the error it just called?
body: <p>I was trying to throw errors in my Golang program with <code>log.Fatal</code> but, <code>log.Fatal</code> does not also print the line where the <code>log.Fatal</code> was ran. Is there no way of getting access to the line number that called log.Fatal? i.e. is there a way to get the line number when throwing an error?</p>
  
  <p>I was trying to google this but was unsure how. The best thing I could get was <a href="http://golang.org/pkg/runtime/debug/#PrintStack">printing the stack trace</a>, which I guess is good but might be a little too much. I also don't want to write <code>debug.PrintStack()</code> every time I need the line number, I am just surprised there isn't any built in function for this like <code>log.FatalStackTrace()</code> or something that isn't costume.</p>
  
  <p>Also, the reason I do not want to make my own debugging/error handling stuff is because I don't want people to have to learn how to use my special costume handling code. I just want something standard where people can read my code later and be like </p>
  
  <blockquote>
    <p>"ah ok, so its throwing an error and doing X..."</p>
  </blockquote>
  
  <p>The less people have to learn about my code the better :)</p>