Skip to content

Upgrade github.com/go-json-experiment/json #3

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

Merged
merged 1 commit into from
Jul 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ module github.com/go-json-experiment/jsonsplit
go 1.24.2

require (
github.com/go-json-experiment/json v0.0.0-20250626171732-1a886bd29d1b
github.com/go-json-experiment/json v0.0.0-20250714165856-be8212f5270d
github.com/google/go-cmp v0.7.0
)
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
github.com/go-json-experiment/json v0.0.0-20250626171732-1a886bd29d1b h1:ooF9/NzXkXL3OOLRwtPuQT/D7Kx2S5w/Kl1GnMF9h2s=
github.com/go-json-experiment/json v0.0.0-20250626171732-1a886bd29d1b/go.mod h1:TiCD2a1pcmjd7YnhGH0f/zKNcCD06B029pHhzV23c2M=
github.com/go-json-experiment/json v0.0.0-20250714165856-be8212f5270d h1:+d6m5Bjvv0/RJct1VcOw2P5bvBOGjENmxORJYnSYDow=
github.com/go-json-experiment/json v0.0.0-20250714165856-be8212f5270d/go.mod h1:TiCD2a1pcmjd7YnhGH0f/zKNcCD06B029pHhzV23c2M=
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
8 changes: 5 additions & 3 deletions jsonsplit.go
Original file line number Diff line number Diff line change
Expand Up @@ -1003,12 +1003,14 @@ var defaultOptionsV1 = map[string]func(bool) jsonv2.Options{
"jsontext.EscapeForJS": jsontext.EscapeForJS,
"jsontext.PreserveRawStrings": jsontext.PreserveRawStrings,
"jsonv1.CallMethodsWithLegacySemantics": jsonv1.CallMethodsWithLegacySemantics,
"jsonv1.EscapeInvalidUTF8": jsonv1.EscapeInvalidUTF8,
"jsonv1.FormatByteArrayAsArray": jsonv1.FormatByteArrayAsArray,
"jsonv1.FormatBytesWithLegacySemantics": jsonv1.FormatBytesWithLegacySemantics,
"jsonv1.FormatTimeWithLegacySemantics": jsonv1.FormatTimeWithLegacySemantics,
"jsonv1.FormatDurationAsNano": jsonv1.FormatDurationAsNano,
"jsonv1.MatchCaseSensitiveDelimiter": jsonv1.MatchCaseSensitiveDelimiter,
"jsonv1.MergeWithLegacySemantics": jsonv1.MergeWithLegacySemantics,
"jsonv1.OmitEmptyWithLegacyDefinition": jsonv1.OmitEmptyWithLegacyDefinition,
"jsonv1.OmitEmptyWithLegacySemantics": jsonv1.OmitEmptyWithLegacySemantics,
"jsonv1.ParseBytesWithLooseRFC4648": jsonv1.ParseBytesWithLooseRFC4648,
"jsonv1.ParseTimeWithLooseRFC3339": jsonv1.ParseTimeWithLooseRFC3339,
"jsonv1.ReportErrorsWithLegacySemantics": jsonv1.ReportErrorsWithLegacySemantics,
"jsonv1.StringifyWithLegacySemantics": jsonv1.StringifyWithLegacySemantics,
"jsonv1.UnmarshalArrayFromAnyLength": jsonv1.UnmarshalArrayFromAnyLength,
Expand Down
2 changes: 1 addition & 1 deletion jsonsplit_example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,5 +79,5 @@ func Example() {
// GoValue: {FirstName:John LastName:Dupe Age:0 Aliases:[]}
// JSONValueV1: {"firstName":"John","lastName":"Dupe","tags":null}
// JSONValueV2: {"firstName":"John","lastName":"Dupe","age":0,"tags":[]}
// Options: [jsonv1.OmitEmptyWithLegacyDefinition jsonv2.FormatNilSliceAsNull]
// Options: [jsonv1.OmitEmptyWithLegacySemantics jsonv2.FormatNilSliceAsNull]
}
36 changes: 8 additions & 28 deletions jsonsplit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,35 +73,15 @@ func TestCodecMarshal(t *testing.T) {
}, {
mode: CallBothButReturnV1,
in: "\xde\xad\xbe\xef",
diffOpts: optsOf(jsontext.AllowInvalidUTF8, jsonv1.EscapeInvalidUTF8),
}, {
mode: CallBothButReturnV1,
in: "\xde\xad\xbe\xef",
inOpts: jsonv1.EscapeInvalidUTF8(false),
diffOpts: optsOf(jsontext.AllowInvalidUTF8),
}, {
mode: CallBothButReturnV1,
in: "\xde\xad\xbe\xef",
inOpts: jsonv1.EscapeInvalidUTF8(true),
diffOpts: optsOf(jsontext.AllowInvalidUTF8),
}, {
mode: CallBothButReturnV2,
in: "\xde\xad\xbe\xef",
diffOpts: optsOf(jsontext.AllowInvalidUTF8, jsonv1.EscapeInvalidUTF8),
}, {
mode: CallBothButReturnV2,
in: "\xde\xad\xbe\xef",
inOpts: jsonv1.EscapeInvalidUTF8(false),
diffOpts: optsOf(jsontext.AllowInvalidUTF8),
}, {
mode: CallBothButReturnV2,
in: "\xde\xad\xbe\xef",
inOpts: jsonv1.EscapeInvalidUTF8(true),
diffOpts: optsOf(jsontext.AllowInvalidUTF8),
}, {
mode: CallV2ButUponErrorReturnV1,
in: "\xde\xad\xbe\xef",
diffOpts: optsOf(jsontext.AllowInvalidUTF8, jsonv1.EscapeInvalidUTF8),
diffOpts: optsOf(jsontext.AllowInvalidUTF8),
}, {
mode: OnlyCallV2,
in: "\xde\xad\xbe\xef",
Expand All @@ -117,7 +97,7 @@ func TestCodecMarshal(t *testing.T) {
in: struct {
A int `json:",omitempty"`
}{},
diffOpts: optsOf(jsonv1.OmitEmptyWithLegacyDefinition),
diffOpts: optsOf(jsonv1.OmitEmptyWithLegacySemantics),
}, {
mode: CallBothButReturnV2,
in: struct {
Expand All @@ -127,7 +107,7 @@ func TestCodecMarshal(t *testing.T) {
}, {
mode: CallBothButReturnV2,
in: time.Second,
diffOpts: optsOf(jsonv1.FormatTimeWithLegacySemantics),
diffOpts: optsOf(jsonv1.FormatDurationAsNano),
}, {
mode: CallBothButReturnV1,
in: struct {
Expand All @@ -149,7 +129,7 @@ func TestCodecMarshal(t *testing.T) {
}, {
mode: CallBothButReturnV2,
in: [32]byte{},
diffOpts: optsOf(jsonv1.FormatBytesWithLegacySemantics),
diffOpts: optsOf(jsonv1.FormatByteArrayAsArray),
}, {
mode: CallBothButReturnV1,
in: func() any {
Expand Down Expand Up @@ -363,12 +343,12 @@ func TestCodecUnmarshal(t *testing.T) {
mode: CallV1ButUponErrorReturnV2,
in: []byte(`"AAAAAAAAAAAAAAAAAAAAAA=="`),
newOut: newer[[16]byte](),
diffOpts: optsOf(jsonv1.FormatBytesWithLegacySemantics),
diffOpts: optsOf(jsonv1.FormatByteArrayAsArray),
}, {
mode: CallV2ButUponErrorReturnV1,
in: []byte(`"AAAA\r\nAAAAAAAAAAAAAAAAAA=="`),
newOut: newer[[]byte](),
diffOpts: optsOf(jsonv1.FormatBytesWithLegacySemantics),
diffOpts: optsOf(jsonv1.ParseBytesWithLooseRFC4648),
}, {
mode: CallBothButReturnV1,
in: []byte(`[1,2,3]`),
Expand All @@ -378,7 +358,7 @@ func TestCodecUnmarshal(t *testing.T) {
mode: CallV2ButUponErrorReturnV1,
in: []byte(`"2000-01-01T00:00:00,0Z"`),
newOut: newer[time.Time](),
diffOpts: optsOf(jsonv1.FormatTimeWithLegacySemantics),
diffOpts: optsOf(jsonv1.ParseTimeWithLooseRFC3339),
}, {
mode: CallV2ButUponErrorReturnV1,
in: []byte(`[1,2,3]`),
Expand All @@ -388,7 +368,7 @@ func TestCodecUnmarshal(t *testing.T) {
mode: CallV2ButUponErrorReturnV1,
in: []byte(`1234`),
newOut: newer[time.Duration](),
diffOpts: optsOf(jsonv1.FormatTimeWithLegacySemantics),
diffOpts: optsOf(jsonv1.FormatDurationAsNano),
}, {
mode: CallBothButReturnV2,
in: []byte(`{"A":"true"}`),
Expand Down
Loading