cue-lang/cue

cmd/cue: JSON parse error reports wrong position in file

Closed this issue · 1 comments

Originally opened by @rogpeppe in cuelang/cue#1017

commit aa61ee7

The error printed when parsing an invalid JSON file isn't tagged with the correct position information.

! exec cue export x.json
stderr 'x\.json:3:5'
-- x.json --
[
  {
    x: 5926
  }
]

The error message that's printed is:

invalid JSON for file "$WORK/x.json": invalid character 'x' looking for beginning of object key string:
    ./x.json:1:1

but the error is not on the first character of the first line.

@rogpeppe created this issue again in #3317, which is now fixed in master. Closing as a dupe.