template: replace deprecated os.SEEK_SET with io.SeekStart
This commit is contained in:
parent
dde7302265
commit
c6e6220fef
|
@ -408,7 +408,7 @@ func ParseFile(path string) (*Template, error) {
|
||||||
defer os.Remove(f.Name())
|
defer os.Remove(f.Name())
|
||||||
defer f.Close()
|
defer f.Close()
|
||||||
io.Copy(f, os.Stdin)
|
io.Copy(f, os.Stdin)
|
||||||
f.Seek(0, os.SEEK_SET)
|
f.Seek(0, io.SeekStart)
|
||||||
} else {
|
} else {
|
||||||
f, err = os.Open(path)
|
f, err = os.Open(path)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -423,7 +423,7 @@ func ParseFile(path string) (*Template, error) {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
// Rewind the file and get a better error
|
// Rewind the file and get a better error
|
||||||
f.Seek(0, os.SEEK_SET)
|
f.Seek(0, io.SeekStart)
|
||||||
// Grab the error location, and return a string to point to offending syntax error
|
// Grab the error location, and return a string to point to offending syntax error
|
||||||
line, col, highlight := highlightPosition(f, syntaxErr.Offset)
|
line, col, highlight := highlightPosition(f, syntaxErr.Offset)
|
||||||
err = fmt.Errorf("Error parsing JSON: %s\nAt line %d, column %d (offset %d):\n%s", err, line, col, syntaxErr.Offset, highlight)
|
err = fmt.Errorf("Error parsing JSON: %s\nAt line %d, column %d (offset %d):\n%s", err, line, col, syntaxErr.Offset, highlight)
|
||||||
|
|
Loading…
Reference in New Issue