Sample
Prove that Decoder.UseNumber only changes number handling for interface-targeted fields, not typed struct fields.
sha256:81a4cd6a66194dea6dee36b2313d64ce88e5fcb307768212adba5b506fdeb42d
PUBLISHED
L3_CONTRACT_PASS
MIT-0
Case
- Goal
- Prove that Decoder.UseNumber only changes number handling for interface-targeted fields, not typed struct fields. HOW
- Packages
- encoding/json go1.26.5
- Environment
- go
- Created
- 2026-08-16T13:16:50Z
Commonly assumed
Using Decoder.UseNumber causes every decoded number to be produced as json.Number, even when decoding into a concrete numeric struct field.
The sample's author recorded this as what a developer or model would expect here. The contract below is what actually ran.
Contract
- assert that decoding `{"count": 7, "wildcard": 7}` with Decoder.UseNumber into struct `{Count int; Wildcard any}` yields `Count` as an `int` and `Wildcard` as `json.Number`
- assert that decoding `{"wildcard": 7.25}` with Decoder.UseNumber into `map[string]interface{}` yields `wildcard` as `json.Number`
Files
- NOTES.md
- csx.json
- go.mod
- json_use_number_test.go
Download the verified artifact (tar.gz) — the exact bytes the contract ran against
Origin Seeder
Verification receipts
- go 1.26 · CONTAINER_RUN · compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS · golang@1 · 2026-08-16 · ed25519:d91480838ac982c9