big overhaul of error-formatting, to get positions more consistently

fixes #2
This commit is contained in:
Ben Kraft
2021-04-15 17:01:46 -07:00
parent ade01c9280
commit 2c087c7821
18 changed files with 233 additions and 74 deletions
+1 -2
View File
@@ -2,7 +2,6 @@ package generate
import (
"errors"
"fmt"
"go/format"
"io/ioutil"
"os"
@@ -20,7 +19,7 @@ func gofmt(filename, src string) (string, error) {
src = strings.TrimSpace(src)
formatted, err := format.Source([]byte(src))
if err != nil {
return src, fmt.Errorf("go parse error in %v: %w", filename, err)
return src, errorf(nil, "go parse error in %v: %v", filename, err)
}
return string(formatted), nil
}