diff --git a/.github/workflows/func-tests.yml b/.github/workflows/func-tests.yml index ea82baf..c6dfed6 100644 --- a/.github/workflows/func-tests.yml +++ b/.github/workflows/func-tests.yml @@ -10,6 +10,7 @@ on: env: GO_VERSION: 1.25.6 + GOEXPERIMENT: jsonv2 DOCKER_API_VERSION: 1.45 jobs: diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index 2d3a51e..c76b086 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -8,6 +8,7 @@ on: env: GO_VERSION: 1.25.6 + GOEXPERIMENT: jsonv2 permissions: contents: read diff --git a/.github/workflows/jepsen-cluster-tests.yml b/.github/workflows/jepsen-cluster-tests.yml index 18a1197..61cd626 100644 --- a/.github/workflows/jepsen-cluster-tests.yml +++ b/.github/workflows/jepsen-cluster-tests.yml @@ -6,6 +6,7 @@ on: env: GO_VERSION: 1.25.6 + GOEXPERIMENT: jsonv2 jobs: test: diff --git a/.github/workflows/jepsen-sentinel-tests.yml b/.github/workflows/jepsen-sentinel-tests.yml index 16bb40b..8aab179 100644 --- a/.github/workflows/jepsen-sentinel-tests.yml +++ b/.github/workflows/jepsen-sentinel-tests.yml @@ -6,6 +6,7 @@ on: env: GO_VERSION: 1.25.6 + GOEXPERIMENT: jsonv2 jobs: test: diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index d17e7fb..8c61083 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -9,6 +9,7 @@ on: env: GO_VERSION: 1.25.6 + GOEXPERIMENT: jsonv2 jobs: unittest: diff --git a/Makefile b/Makefile index ce07578..3f74e34 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,7 @@ PROJECT=rdsync ZK_VERSION=3.9.4 cmd/rdsync/rdsync: - GOOS=linux go build -tags netgo,osusergo -o ./cmd/rdsync/rdsync ./cmd/rdsync/... + GOEXPERIMENT=jsonv2 GOOS=linux go build -tags netgo,osusergo -o ./cmd/rdsync/rdsync ./cmd/rdsync/... format: gofmt -s -w `find . -name '*.go'` @@ -24,8 +24,8 @@ test: base_image valkey/src/valkey-server cmd/rdsync/rdsync recreate_logs rm -rf ./tests/images/valkey/valkey-server && cp valkey/src/valkey-server ./tests/images/valkey/valkey-server rm -rf ./tests/images/valkey/valkey-senticache && cp valkey/src/valkey-senticache ./tests/images/valkey/valkey-senticache rm -rf ./tests/images/valkey/valkey-cli && cp valkey/src/valkey-cli ./tests/images/valkey/valkey-cli - go build ./tests/... - (cd tests; go test -timeout 180m) + GOEXPERIMENT=jsonv2 go build ./tests/... + (cd tests; GOEXPERIMENT=jsonv2 go test -timeout 180m) recreate_logs: @if [ "$(shell ls tests/logs 2>/dev/null | wc -l)" != "0" ]; then\ diff --git a/internal/app/info_file.go b/internal/app/info_file.go index e721399..b2f6c36 100644 --- a/internal/app/info_file.go +++ b/internal/app/info_file.go @@ -1,7 +1,7 @@ package app import ( - "encoding/json" + json "encoding/json/v2" "log/slog" "os" "time" diff --git a/internal/dcs/zk.go b/internal/dcs/zk.go index f34eeee..4f62d26 100644 --- a/internal/dcs/zk.go +++ b/internal/dcs/zk.go @@ -2,7 +2,7 @@ package dcs import ( "context" - "encoding/json" + json "encoding/json/v2" "fmt" "log/slog" "net" diff --git a/tests/rdsync_test.go b/tests/rdsync_test.go index 7cf81cd..2f00e67 100644 --- a/tests/rdsync_test.go +++ b/tests/rdsync_test.go @@ -2,7 +2,7 @@ package tests import ( "context" - "encoding/json" + json "encoding/json/v2" "fmt" "html/template" "io" @@ -806,9 +806,6 @@ func (tctx *testContext) createZookeeperNode(node string) error { func (tctx *testContext) stepISetZookeeperNode(node string, body *godog.DocString) error { data := []byte(strings.TrimSpace(body.Content)) - if !json.Valid(data) { - return fmt.Errorf("node value is not valid json") - } _, stat, err := tctx.zk.Get(node) if err != nil && err != zk.ErrNoNode { return err diff --git a/tests/testutil/matchers/matchers.go b/tests/testutil/matchers/matchers.go index e8511bb..c19405c 100644 --- a/tests/testutil/matchers/matchers.go +++ b/tests/testutil/matchers/matchers.go @@ -1,7 +1,7 @@ package matchers import ( - "encoding/json" + json "encoding/json/v2" "fmt" "reflect" "regexp"