From 99c864ba763f5fd33cff9bbe570592fecfe03ef6 Mon Sep 17 00:00:00 2001 From: Alexander Kiel Date: Thu, 14 Aug 2025 19:37:42 +0200 Subject: [PATCH] Enable Go 1.25 JSONv2 Experiment That should improve the JSON marshalling/unmarshalling performance. --- .github/workflows/build.yml | 5 +++-- Makefile | 10 ++++++++++ fhir/client_test.go | 2 +- 3 files changed, 14 insertions(+), 3 deletions(-) create mode 100644 Makefile diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 22c52f4..8c6dbf4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -51,13 +51,13 @@ jobs: version: v2.5.0 - name: Test - run: go test -v ./... + run: make test - name: Fuzz Test run: go test -fuzz=FuzzCalculateFileChunks -fuzztime=10s ./util - name: Build - run: go build . + run: make build - name: Perform CodeQL Analysis uses: github/codeql-action/analyze@76621b61decf072c1cee8dd1ce2d2a82d33c17ed # v3 @@ -117,6 +117,7 @@ jobs: - name: Build env: CGO_ENABLED: '0' + GOEXPERIMENT: 'jsonv2' GOOS: ${{ matrix.os }} GOARCH: ${{ matrix.arch }} run: go build . diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..a1a89e2 --- /dev/null +++ b/Makefile @@ -0,0 +1,10 @@ +lint: + golangci-lint run + +test: + GOEXPERIMENT=jsonv2 go test ./... + +build: + GOEXPERIMENT=jsonv2 go build . + +.PHONY: lint test build diff --git a/fhir/client_test.go b/fhir/client_test.go index 86d90e0..e81cb8b 100644 --- a/fhir/client_test.go +++ b/fhir/client_test.go @@ -494,7 +494,7 @@ func TestPollAsyncStatus(t *testing.T) { _, err := pollAsyncStatus(server) - assert.Equal(t, "error while reading the outcome of an error response in the async response bundle: json: cannot unmarshal array into Go value of type fhir.OperationOutcome", err.Error()) + assert.Equal(t, "error while reading the outcome of an error response in the async response bundle: json: cannot unmarshal JSON array into Go type fhir.OperationOutcome", err.Error()) }) t.Run("async response with error bundle entry with outcome", func(t *testing.T) {