kisielk/errcheck — pull request #43 by benbjohnson (2014-09-09 15:36:31+00:00)
Title: Fix panic when using line number pragmas

This commit fixes an issue where generated files that use line pragmas would cause errcheck to panic. This occurred because errcheck would try to look up the line from the file but the file did not exist in the checker so an "index out of bounds" panic would occur.

The fix does not try to parse every generated file but instead opts to simply return the line number and character position. The actual line itself is returned as blank.

---

For reference, a line pragma looks like:

```
package main

import "os"

func main() {
//line myfile.txt:2
f, err := os.Open("test")
//line myfile.txt:3
f.Close()
}
```

If an error occurred for the `f.Close()` then it will report the error coming from `myfile.txt:3` instead of `main.go:9`.