ToValue silently stringifies unsupported types (uint, int8, []string, ...)
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- Half a day
- Newbie friendliness
- 55/100
Research direction
The fallthrough lives in ToValue in util.go, around the lines the issue links, where unknown types go to StringValue(fmt.Sprintf("%#v", v)). Start by reading that switch and the existing tests for it, then reproduce with tree.V(uint(3)). Done means the integer, float and common slice/map kinds convert properly and unsupported types panic in V or return an error from a new variant.
Written by the indexing model from the issue text.
Description
Problem
Any type not listed in ToValue falls through to StringValue(fmt.Sprintf("%#v", v)) and succeeds:
tree.V(uint(3)) // StringValue("0x3")
uint, int8, int16, uint8, uint16, []string, []Node, map[string]string and so on are all turned into Go-syntax strings without any signal.
https://github.com/mojatter/tree/blob/2d4fd3d11f3e28c7c95f51d091b94ef0a6ed18f1/util.go#L67-L68
Proposed fix
Cover all integer/float kinds (possibly via reflect kind switching) and common slice/map shapes. For anything still unsupported, panic (for V) or return an error from an error-returning variant rather than producing a misleading string.
- Dominant language
- Go
- Stars
- 7
- Forks
- 2
- Avg merge
- 11h 12m
- Merged PRs (30d)
- 43
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
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 68/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
-
bug
Difficulty 3/5 1-2 days Newbie friendliness 65/100
Maintainers usually reply within 1 day
-
query: Read null like jq in key steps, comparisons and contains()Possibly taken @mojatter claimed this 1 day ago. Openbug
Difficulty 4/5 3-5 days Newbie friendliness 55/100
mojatter/tree#152 · 3 comments · 1 assignee ·
Maintainers usually reply within 1 day
Similar issues
-
[flaky test] TestValidatorCommitterDropsEmptyStatusBatch: submits to the mock VC before its stream is registeredPossibly taken @liran-funaro claimed this today. Opencoordinator flaky-test race-condition testing
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
hyperledger/fabric-x-committer#876 ·
Maintainers usually reply within 1 day
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
garethgeorge/backrest#1426 ·
Maintainers usually reply within 1 day
-
enhancement nav-pilot
Difficulty 2/5 Half a day Newbie friendliness 62/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
valkey-io/valkey-operator#549 · 1 comment ·
Maintainers usually reply within 3 days
-
kind/features
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
TencentBlueKing/bk-nodemgr#3804 ·
Maintainers usually reply within 1 day