• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

sonatard / gqlgen / 37175564328
0%
master: 0%

Build:
Build:
LAST BUILD BRANCH: exec-behavior-tests
DEFAULT BRANCH: master
Ran 04 Oct 2026 04:00AM UTC
Jobs 1
Files 0
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

04 Oct 2026 03:57AM UTC coverage: 0.0%. Remained the same
37175564328

Pull #1

github

sonatard
Decode request bodies with encoding/json/v2

On Go 1.27, encoding/json is implemented on top of encoding/json/v2, and
its Decoder buffers each value with ReadValue before unmarshaling it a
second time. jsonDecode (json.Decoder with UseNumber) became about 75%
slower than on Go 1.26 for variable-heavy requests, and every user goes
through it once go.mod requires Go 1.27.

jsonDecode now uses encoding/json/v2 directly. It runs with
jsonv1.DefaultOptionsV1(), the options encoding/json itself is built on,
so it decodes and reports errors exactly as encoding/json's Decoder
with UseNumber does:

- UseNumber has no public option in encoding/json/v2 (encoding/json
  reaches it through an internal flag), so values headed for `any` are
  built from the token stream with numbers kept as json.Number.
  Returning errors.ErrUnsupported for non-numbers would be shorter but
  was about 2.5 times slower.
- Truncated input is reported as io.ErrUnexpectedEOF, as
  (*json.Decoder).Decode does.
- Each call gets a fresh jsontext.Decoder, as each json.NewDecoder call
  did. Pooling them was about 20% faster for small bodies, but a pooled
  Decoder's larger buffer changed the text of some syntax errors.

TestJSONDecodeMatchesEncodingJSON and FuzzJSONDecodeMatchesEncodingJSON
require the same error message or the same parameters as
encoding/json's Decoder with UseNumber.

BenchmarkJSONDecode, large body: 1.39ms with encoding/json on Go 1.27,
592µs with encoding/json/v2 (790µs with the Go 1.26 implementation).

This needs go.mod at go 1.27: with go 1.26, go vet's stdversion check
rejects the encoding/json/v2 calls. GOEXPERIMENT=nojsonv2 builds are
not supported.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Pull Request #1: Decode request bodies with encoding/json/v2

0 of 0 relevant lines covered (NaN%)

0.0 hits per line

Jobs
ID Job ID Ran Files Coverage
1 37175564328.1 04 Oct 2026 04:00AM UTC 0
0.0
GitHub Action Run
Source Files on build 37175564328
Detailed source file information is not available for this build.
  • Back to Repo
  • Pull Request #1
  • PR Base - jsonv2-go127 (#37171808750)
  • Delete
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc