From 76baae6ce8e0b25a5a35336cf9fe1f91b384eea8 Mon Sep 17 00:00:00 2001 From: Masaaki Goshima Date: Sun, 27 Dec 2020 20:42:43 +0900 Subject: [PATCH] Fix streaming decoder for float value --- decode_float.go | 3 --- stream_test.go | 3 +-- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/decode_float.go b/decode_float.go index 3e1d1cb..47a0cdf 100644 --- a/decode_float.go +++ b/decode_float.go @@ -114,9 +114,6 @@ func (d *floatDecoder) decodeStream(s *stream, p unsafe.Pointer) error { if err != nil { return err } - if !validEndNumberChar[s.char()] { - return errUnexpectedEndOfJSON("float", s.totalOffset()) - } str := *(*string)(unsafe.Pointer(&bytes)) f64, err := strconv.ParseFloat(str, 64) if err != nil { diff --git a/stream_test.go b/stream_test.go index 4be9acb..8fee6cd 100644 --- a/stream_test.go +++ b/stream_test.go @@ -12,6 +12,7 @@ import ( "net" "net/http" "net/http/httptest" + "reflect" "strings" "testing" @@ -186,7 +187,6 @@ func nlines(s string, n int) string { return s } -/* func TestDecoder(t *testing.T) { for i := 0; i <= len(streamTest); i++ { // Use stream without newlines as input, @@ -218,7 +218,6 @@ func TestDecoder(t *testing.T) { } } } -*/ func TestDecoderBuffered(t *testing.T) { r := strings.NewReader(`{"Name": "Gopher"} extra `)