-
Notifications
You must be signed in to change notification settings - Fork 2.8k
refactor: migrate from go-json-experiment to encoding/json/v2 #9422
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor: migrate from go-json-experiment to encoding/json/v2 #9422
Conversation
This migration replaces github.com/go-json-experiment/json with the official encoding/json/v2 package introduced in Go 1.25. Changes: - Update Go version to 1.25 - Replace all imports from go-json-experiment/json to encoding/json/v2 - Replace all imports from go-json-experiment/json/jsontext to encoding/json/jsontext - Remove external dependency from go.mod - Configure mage to use GOEXPERIMENT=jsonv2 for all build commands - All tests pass with the experimental json/v2 package Requires GOEXPERIMENT=jsonv2 environment variable until json/v2 becomes default.
- Update golangci-lint configuration to Go 1.25 - Add GOEXPERIMENT=jsonv2 to GitHub Actions lint step - Update golangci-lint version in cache workflow - Add GOEXPERIMENT=jsonv2 to magefiles (already done by user)
- Fix import ordering in all files using encoding/json/v2 - Add ENV to modernize tool invocations in magefiles - Ensure consistent import grouping per gci rules
|
@nikpivkin Can you please take a look? I remember you introduced the package. I'd request your review. |
@knqyf263 Nikita is currently away on vacation he will be back on 14th. |
simar7
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yesterday the team published an official blog post which is a good read https://go.dev/blog/jsonv2-exp
Thanks. Yes, I remembered that right after asking him. This PR is not urgent. I'll wait for him. |
…curity#9422) Co-authored-by: knqyf263 <[email protected]> Co-authored-by: nikpivkin <[email protected]>
Description
This PR migrates from the experimental
github.com/go-json-experiment/jsonpackage to the newencoding/json/v2package that is available in Go 1.25 as an experimental feature.Changes
go.modfd.axjsq.dpdns.org/go-json-experiment/jsontoencoding/json/v2fd.axjsq.dpdns.org/go-json-experiment/json/jsontexttoencoding/json/jsontextGOEXPERIMENT=jsonv2to the build environment in magefilesfd.axjsq.dpdns.org/go-json-experiment/jsonfromgo.modContext
Go 1.25 introduces experimental support for
encoding/json/v2.The new package is enabled by setting
GOEXPERIMENT=jsonv2at build time, which has been configured in our build system.Notes
GOEXPERIMENT=jsonv2flag which enables the new JSON implementationgo-json-experimentpackageReferences
Checklist