From 6a11c84d0c703f0a4d8b89dca99e74f0584fabc0 Mon Sep 17 00:00:00 2001 From: Masaaki Goshima Date: Wed, 18 Nov 2020 16:47:50 +0900 Subject: [PATCH 1/6] Fix test case --- json_test.go | 3 --- 1 file changed, 3 deletions(-) diff --git a/json_test.go b/json_test.go index f3a066c..1ed0074 100644 --- a/json_test.go +++ b/json_test.go @@ -225,9 +225,6 @@ var ( ) func initBig() { - if len(jsonBig) > 0 { - return - } n := 10000 if testing.Short() { n = 100 From 35395bba607e05ebd5e618e060f82134408a594c Mon Sep 17 00:00:00 2001 From: Masaaki Goshima Date: Wed, 18 Nov 2020 17:05:27 +0900 Subject: [PATCH 2/6] Keep unsafe.Pointer reference for handling of opInterface --- encode_vm.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/encode_vm.go b/encode_vm.go index 744e592..2a83ca0 100644 --- a/encode_vm.go +++ b/encode_vm.go @@ -216,6 +216,7 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, code *opcode) error { } seenPtr[ptr] = struct{}{} v := e.ptrToInterface(code, ptr) + ctx.keepRefs = append(ctx.keepRefs, unsafe.Pointer(&v)) rv := reflect.ValueOf(v) if rv.IsNil() { e.encodeNull() @@ -292,6 +293,7 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, code *opcode) error { } seenPtr[ptr] = struct{}{} v := e.ptrToInterface(code, ptr) + ctx.keepRefs = append(ctx.keepRefs, unsafe.Pointer(&v)) rv := reflect.ValueOf(v) if rv.IsNil() { e.encodeNull() From 5701138d7d0cffc13fc70f7c46f9f2ae4cbf942d Mon Sep 17 00:00:00 2001 From: Masaaki Goshima Date: Thu, 19 Nov 2020 02:12:48 +0900 Subject: [PATCH 3/6] Update CI settings --- .github/workflows/go.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index db2ebbc..76b4631 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -21,5 +21,8 @@ jobs: - name: Test run: go test -v ./ + - name: Test with GC + run: GOGC=1 go test -v ./ + - name: Test with race detector run: go test -v -race ./ From df0b68da4d296d73b2be8fbcbfcd5d1c487975dd Mon Sep 17 00:00:00 2001 From: Masaaki Goshima Date: Thu, 19 Nov 2020 02:16:05 +0900 Subject: [PATCH 4/6] Fix test option --- .github/workflows/go.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 76b4631..f0a67fe 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -19,10 +19,10 @@ jobs: uses: actions/checkout@v2 - name: Test - run: go test -v ./ + run: go test -v ./ -count=1 - name: Test with GC - run: GOGC=1 go test -v ./ + run: GOGC=1 go test -v ./ -count=1 - name: Test with race detector - run: go test -v -race ./ + run: go test -v -race ./ -count=1 From e319a33e70ebcf715bf4bd745e56c6d4bca2aa4a Mon Sep 17 00:00:00 2001 From: Masaaki Goshima Date: Thu, 19 Nov 2020 02:21:04 +0900 Subject: [PATCH 5/6] Omit test with race detector --- .github/workflows/go.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index f0a67fe..43d6d55 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -24,5 +24,5 @@ jobs: - name: Test with GC run: GOGC=1 go test -v ./ -count=1 - - name: Test with race detector - run: go test -v -race ./ -count=1 + # - name: Test with race detector + # run: go test -v -race ./ -count=1 From 18e2d87772be74e8980a624b5c39006543918cdc Mon Sep 17 00:00:00 2001 From: Masaaki Goshima Date: Thu, 19 Nov 2020 02:26:56 +0900 Subject: [PATCH 6/6] Fix env settings --- .github/workflows/go.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 43d6d55..b0ab8dd 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -22,7 +22,9 @@ jobs: run: go test -v ./ -count=1 - name: Test with GC - run: GOGC=1 go test -v ./ -count=1 + run: go test -v ./ -count=1 + env: + GOGC: 1 # - name: Test with race detector # run: go test -v -race ./ -count=1