(experimental) upgraded to encoding/json/v2

This commit is contained in:
Gani Georgiev committed 2026-08-18 18:16:22 +03:00
1 parent 4d4275c9aa
commit 97dd775455
125 files changed
+433 -364

No files matched your search

+2 -2
View File
@@ -1,7 +1,7 @@
package cron
import (
"encoding/json"
"encoding/json/v2"
"slices"
"sync"
"testing"
@@ -128,7 +128,7 @@ func TestCronAddAndRemove(t *testing.T) {
"test5": `{"minutes":{"1":{}},"hours":{"2":{}},"days":{"3":{}},"months":{"4":{}},"daysOfWeek":{"5":{}}}`,
}
for k, v := range expectedSchedules {
raw, err := json.Marshal(indexedJobs[k].schedule)
raw, err := json.Marshal(indexedJobs[k].schedule, json.Deterministic(true))
if err != nil {
t.Fatal(err)
}
+1 -1
View File
@@ -1,6 +1,6 @@
package cron
import "encoding/json"
import "encoding/json/v2"
// Job defines a single registered cron job.
type Job struct {
+2 -2
View File
@@ -1,7 +1,7 @@
package cron
import (
"encoding/json"
"encoding/json/v2"
"testing"
)
@@ -59,7 +59,7 @@ func TestJobMarshalJSON(t *testing.T) {
j := Job{id: "test_id", schedule: s}
raw, err := json.Marshal(j)
raw, err := json.Marshal(j, json.Deterministic(true))
if err != nil {
t.Fatal(err)
}
+2 -2
View File
@@ -1,7 +1,7 @@
package cron_test
import (
"encoding/json"
"encoding/json/v2"
"fmt"
"testing"
"time"
@@ -265,7 +265,7 @@ func TestNewSchedule(t *testing.T) {
return
}
encoded, err := json.Marshal(schedule)
encoded, err := json.Marshal(schedule, json.Deterministic(true))
if err != nil {
t.Fatalf("Failed to marshalize the result schedule: %v", err)
}