From bd91a10d7bff6000469eed58d999d2d224cbd3c2 Mon Sep 17 00:00:00 2001 From: Jefftree Date: Fri, 16 Aug 2024 14:03:31 -0400 Subject: [PATCH 1/2] Patch go-json-experiment/json negative float test --- .../third_party/go-json-experiment/json/arshal_test.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pkg/internal/third_party/go-json-experiment/json/arshal_test.go b/pkg/internal/third_party/go-json-experiment/json/arshal_test.go index 952d4d0f9..f2235c5ea 100644 --- a/pkg/internal/third_party/go-json-experiment/json/arshal_test.go +++ b/pkg/internal/third_party/go-json-experiment/json/arshal_test.go @@ -1351,7 +1351,7 @@ func TestMarshal(t *testing.T) { Bytes: []byte{}, // not omitted since allocated slice is non-zero Int: 1, // not omitted since 1 is non-zero Uint: 1, // not omitted since 1 is non-zero - Float: math.Copysign(0, -1), // not omitted since -0 is technically non-zero + Float: math.SmallestNonzeroFloat64, // not omitted since still slightly above zero Map: map[string]string{}, // not omitted since allocated map is non-zero StructScalars: structScalars{unexported: true}, // not omitted since unexported is non-zero StructSlices: structSlices{Ignored: true}, // not omitted since Ignored is non-zero @@ -1367,7 +1367,7 @@ func TestMarshal(t *testing.T) { "Bytes": "", "Int": 1, "Uint": 1, - "Float": -0, + "Float": 5e-324, "Map": {}, "StructScalars": { "Bool": false, @@ -1571,7 +1571,7 @@ func TestMarshal(t *testing.T) { PointerSlice: addr([]string{""}), PointerSliceEmpty: addr(sliceMarshalEmpty{"value"}), PointerSliceNonEmpty: addr(sliceMarshalNonEmpty{"value"}), - Pointer: &structOmitZeroEmptyAll{Float: math.Copysign(0, -1)}, + Pointer: &structOmitZeroEmptyAll{Float: math.SmallestNonzeroFloat64}, Interface: []string{""}, }, want: `{ @@ -1616,7 +1616,7 @@ func TestMarshal(t *testing.T) { "value" ], "Pointer": { - "Float": -0 + "Float": 5e-324 }, "Interface": [ "" From 24eb939a50b643f05d910e0ba8d76a838aedc1b1 Mon Sep 17 00:00:00 2001 From: Jefftree Date: Fri, 16 Aug 2024 17:18:33 -0400 Subject: [PATCH 2/2] Update github actions to test for later go versions --- .github/workflows/ci.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bb4262062..dbba6abee 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,13 +6,16 @@ on: branches: [ master ] jobs: ci: + strategy: + matrix: + go-version: [ '1.20', '1.21', '1.22', '1.23' ] runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Set up Go uses: actions/setup-go@v5 with: - go-version-file: 'go.mod' + go-version: ${{ matrix.go-version }} - name: Build run: | go mod tidy && git diff --exit-code