-
Notifications
You must be signed in to change notification settings - Fork 294
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
encoding/json: error positions do not reflect position of error #2776
Labels
Comments
rogpeppe
added
NeedsInvestigation
Triage
Requires triage/attention
NeedsFix
and removed
NeedsInvestigation
Triage
Requires triage/attention
labels
Jan 22, 2024
cueckoo
pushed a commit
that referenced
this issue
Jan 22, 2024
The base offset seems to be a hangover from the origins of the package in [`go/token`](https://pkg.go.dev/go/token#FileSet.AddFile). In that package, it signifies the overall offset inside a set of line information shared amongst between many files. In `cue/token`, by contrast, it doesn't signify anything, witnessed by the fact that when we _do_ try to use it, it [doesn't have the desired effect](#2776). In effect, the base is added to the internal index stored in a `token.Pos` and then removed before it's made visible to the API. Because it's confusing, and because in general we can't say that we're starting at an arbitrary point in a file and hope line and column information will be able to work, we deprecate the API, maintaining all user-visible behavior. Signed-off-by: Roger Peppe <[email protected]> Change-Id: I57d0f54722bf4aa872ef1f36e2d2a8e2e43a5810
cueckoo
pushed a commit
that referenced
this issue
Jan 22, 2024
The base offset seems to be a hangover from the origins of the package in [`go/token`](https://pkg.go.dev/go/token#FileSet.AddFile). In that package, it signifies the overall offset inside a set of line information shared amongst between many files. In `cue/token`, by contrast, it doesn't signify anything, witnessed by the fact that when we _do_ try to use it, it [doesn't have the desired effect](#2776). In effect, the base is added to the internal index stored in a `token.Pos` and then removed before it's made visible to the API. Because it's confusing, and because in general we can't say that we're starting at an arbitrary point in a file and hope line and column information will be able to work, we deprecate the API, maintaining all user-visible behavior. Signed-off-by: Roger Peppe <[email protected]> Change-Id: I57d0f54722bf4aa872ef1f36e2d2a8e2e43a5810
cueckoo
pushed a commit
to cue-lang/cue-trybot
that referenced
this issue
Jan 22, 2024
The base offset seems to be a hangover from the origins of the package in [`go/token`](https://pkg.go.dev/go/token#FileSet.AddFile). In that package, it signifies the overall offset inside a set of line information shared amongst between many files. In `cue/token`, by contrast, it doesn't signify anything, witnessed by the fact that when we _do_ try to use it, it [doesn't have the desired effect](cue-lang/cue#2776). In effect, the base is added to the internal index stored in a `token.Pos` and then removed before it's made visible to the API. Because it's confusing, and because in general we can't say that we're starting at an arbitrary point in a file and hope line and column information will be able to work, we deprecate the API, maintaining all user-visible behavior. Signed-off-by: Roger Peppe <[email protected]> Change-Id: I57d0f54722bf4aa872ef1f36e2d2a8e2e43a5810 Dispatch-Trailer: {"type":"trybot","CL":1175779,"patchset":3,"ref":"refs/changes/79/1175779/3","targetBranch":"master"}
cueckoo
pushed a commit
that referenced
this issue
Jan 22, 2024
The base offset seems to be a hangover from the origins of the package in [`go/token`](https://pkg.go.dev/go/token#FileSet.AddFile). In that package, it signifies the overall offset inside a set of line information shared amongst between many files. In `cue/token`, by contrast, it doesn't signify anything, witnessed by the fact that when we _do_ try to use it, it [doesn't have the desired effect](#2776). In effect, the base is added to the internal index stored in a `token.Pos` and then removed before it's made visible to the API. Because it's confusing, and because in general we can't say that we're starting at an arbitrary point in a file and hope line and column information will be able to work, we deprecate the API, maintaining all user-visible behavior. Signed-off-by: Roger Peppe <[email protected]> Change-Id: I57d0f54722bf4aa872ef1f36e2d2a8e2e43a5810
cueckoo
pushed a commit
to cue-lang/cue-trybot
that referenced
this issue
Jan 22, 2024
The base offset seems to be a hangover from the origins of the package in [`go/token`](https://pkg.go.dev/go/token#FileSet.AddFile). In that package, it signifies the overall offset inside a set of line information shared amongst between many files. In `cue/token`, by contrast, it doesn't signify anything, witnessed by the fact that when we _do_ try to use it, it [doesn't have the desired effect](cue-lang/cue#2776). In effect, the base is added to the internal index stored in a `token.Pos` and then removed before it's made visible to the API. Because it's confusing, and because in general we can't say that we're starting at an arbitrary point in a file and hope line and column information will be able to work, we deprecate the API, maintaining all user-visible behavior. Signed-off-by: Roger Peppe <[email protected]> Change-Id: I57d0f54722bf4aa872ef1f36e2d2a8e2e43a5810 Dispatch-Trailer: {"type":"trybot","CL":1175779,"patchset":4,"ref":"refs/changes/79/1175779/4","targetBranch":"master"}
cueckoo
pushed a commit
that referenced
this issue
Jan 22, 2024
The base offset seems to be a hangover from the origins of the package in [`go/token`](https://pkg.go.dev/go/token#FileSet.AddFile). In that package, it signifies the overall offset inside a set of line information shared amongst between many files. In `cue/token`, by contrast, it doesn't signify anything, witnessed by the fact that when we _do_ try to use it, it [doesn't have the desired effect](#2776). In effect, the base is added to the internal index stored in a `token.Pos` and then removed before it's made visible to the API. Because it's confusing, and because in general we can't say that we're starting at an arbitrary point in a file and hope line and column information will be able to work, we deprecate the API, maintaining all user-visible behavior. Signed-off-by: Roger Peppe <[email protected]> Change-Id: I57d0f54722bf4aa872ef1f36e2d2a8e2e43a5810
cueckoo
pushed a commit
to cue-lang/cue-trybot
that referenced
this issue
Jan 22, 2024
The base offset seems to be a hangover from the origins of the package in [`go/token`](https://pkg.go.dev/go/token#FileSet.AddFile). In that package, it signifies the overall offset inside a set of line information shared amongst between many files. In `cue/token`, by contrast, it doesn't signify anything, witnessed by the fact that when we _do_ try to use it, it [doesn't have the desired effect](cue-lang/cue#2776). In effect, the base is added to the internal index stored in a `token.Pos` and then removed before it's made visible to the API. Because it's confusing, and because in general we can't say that we're starting at an arbitrary point in a file and hope line and column information will be able to work, we deprecate the API, maintaining all user-visible behavior. Signed-off-by: Roger Peppe <[email protected]> Change-Id: I57d0f54722bf4aa872ef1f36e2d2a8e2e43a5810 Dispatch-Trailer: {"type":"trybot","CL":1175779,"patchset":5,"ref":"refs/changes/79/1175779/5","targetBranch":"master"}
Is |
Yup, fixed. |
Note that you created a duplicate of this issue in #3317, now fixed, but this reproducer above shows that we're not fully fixed for NDJSON or JSONL inputs. I'll send a follow-up fix using this tracking issue. |
cueckoo
pushed a commit
that referenced
this issue
Aug 12, 2024
For #2776. Signed-off-by: Daniel Martí <[email protected]> Change-Id: Id353bef957aa768a8a846f7cd0ef51ad9091d5b6 Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1199102 TryBot-Result: CUEcueckoo <[email protected]> Unity-Result: CUE porcuepine <[email protected]> Reviewed-by: Roger Peppe <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What version of CUE are you using (
cue version
)?Does this issue reproduce with the latest stable release?
Yes
What did you do?
What did you expect to see?
A passing test
What did you see instead?
The position of the error bears no relationship to the position that the syntax error actually occurred at.
It always says it's at line 1, column 1.
The text was updated successfully, but these errors were encountered: