Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

edit: Name the receiver and quote the key consistently in edit errors

Open
#202 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
52/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
go
Domain
backend, cli

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 (Array vs *Array for .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

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from mojatter/tree

All issues in mojatter/tree

Similar issues

More Go issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.