edit: Name the receiver and quote the key consistently in edit errors
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 52/100
Research direction
Start with docs/query.md’s Edit errors table and TestEditDocExamples, then trace the edit error paths for the listed cases and compare how receiver types and operations affect the messages. Check issue #111 for the type naming decision. Done means the messages use consistent receiver names and key quoting, the table and examples are updated, and the #98 link is removed.
Written by the indexing model from the issue text.
Description
Edit errors describe the receiver and the step inconsistently. docs/query.md's Edit errors table pins the current messages and links to #98 for the wording, but #98 was closed as a duplicate of #152, which #196 resolved without touching these messages, so nothing tracks them now.
Current messages (Edit on main at f7f7823):
| Edit | Receiver | Message |
|---|---|---|
.a.b = 1 |
{"a": 1} |
cannot index array with "b" |
.a.b = 1 |
{"a": []} (Array or *Array) |
cannot index array with b |
.a.b += 1 |
{"a": []} as Array |
cannot append to "b" |
.a.b += 1 |
{"a": []} as *Array |
cannot index array with b |
.a.b ^? |
{"a": 1} or {"a": []} |
cannot delete "b" |
.a += 1 |
{"a": 1} |
cannot append to "a" |
.a[-5] = 1 |
{"a": []} |
cannot index array with -5 |
.a[-5] += 1 |
{"a": []} |
cannot append to array with -5 |
.a[-5] ^? |
{"a": []} |
cannot delete array with -5 |
.a[]. = 1 |
{"a": 1} |
cannot index array with [] |
.a[1:]. = 1 |
{"a": 1} |
cannot index array with range [1:] |
.a.first() = 1 |
{"a": {}} |
cannot edit first() of a map |
.a.first() = 1 |
{"a": 1} |
cannot index array with 0 |
Problems:
- "array" names a number (
{"a": 1}) and a scalar receiver of[]or a slice, not only arrays. - The key is quoted in some messages (
"b") and not in others (b), for the same step. - The same mistake gets different messages depending on the Go type of the receiver (
Arrayvs*Arrayfor.a.b += 1) or on the operation (=,+=,^?). first()on a scalar reports the index it resolved to (0) rather than the step the user wrote.
Proposed direction: name the receiver's type as type() does (number, array, object, ...), quote keys consistently, and use one message per condition regardless of operation and Go type, e.g. cannot index number with "b", cannot index array with "b", cannot index array with -5, cannot iterate over number for []. Update the Edit errors table and TestEditDocExamples with it, and drop the #98 link from docs/query.md. #111 (unify type names between Type.String() and type()) may decide the type names used here.
- Dominant language
- Go
- Stars
- 7
- Forks
- 2
- Avg merge
- 10h 20m
- Merged PRs (30d)
- 50
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from mojatter/tree
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day
-
Difficulty 4/5 3-5 days Newbie friendliness 48/100
Maintainers usually reply within 1 day
-
enhancement
Difficulty 3/5 1-2 days Newbie friendliness 58/100
Maintainers usually reply within 1 day
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 78/100
slavakurilyak/awesome-ai-agents#880 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
apache/openserverless#282 · 2 comments ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
agent-butler-finding bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
jordansmall/spindrift#6161 ·
Maintainers usually reply within 1 day