mirror of
https://github.com/hashicorp/packer.git
synced 2026-02-22 17:30:47 -05:00
Better display an error message on an encounter of a json.SyntaxError.
Rolls back the file position, to read the entire file, then steps
through the file reading a single byte at a time, populating lines until
encountering the syntax error. Then relays the offending line as well as
the previous line in the file to the user, also placing a `^` that
points the the offending column of the decoder error.
```
➤ packer validate template.json
Failed to parse template: Error parsing JSON: invalid character '"' after object key:value pair
At line 9, column 8 (offset 121):
8: "name": "vbox"
9: "
```
|
||
|---|---|---|
| .. | ||
| interpolate | ||
| test-fixtures | ||
| parse.go | ||
| parse_test.go | ||
| template.go | ||
| template_test.go | ||