From 18a8684873e2b3c4194f74ce7ed8319f0bc916e8 Mon Sep 17 00:00:00 2001 From: Masaaki Goshima Date: Tue, 25 Aug 2020 11:18:01 +0900 Subject: [PATCH] Refactor --- decode_interface.go | 2 +- json_test.go | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/decode_interface.go b/decode_interface.go index 0d0bfc2..aa08daa 100644 --- a/decode_interface.go +++ b/decode_interface.go @@ -165,7 +165,7 @@ func (d *interfaceDecoder) decode(buf []byte, cursor int64, p uintptr) (int64, e cursor++ *(*interface{})(unsafe.Pointer(p)) = *(*string)(unsafe.Pointer(&literal)) return cursor, nil - case '\000': + case nul: return 0, errUnexpectedEndOfJSON("string", cursor) } cursor++ diff --git a/json_test.go b/json_test.go index 1be6c15..3831777 100644 --- a/json_test.go +++ b/json_test.go @@ -199,6 +199,7 @@ func TestIndentErrors(t *testing.T) { } func diff(t *testing.T, a, b []byte) { + t.Helper() for i := 0; ; i++ { if i >= len(a) || i >= len(b) || a[i] != b[i] { j := i - 10