From 12508320c2834204677e29be58fec8103facdaf8 Mon Sep 17 00:00:00 2001 From: Bo-Yi Wu Date: Sat, 8 Jul 2017 16:49:09 +0800 Subject: [PATCH] feat: change json lib to jsoniter A high-performance 100% compatible drop-in replacement of "encoding/json" https://github.com/json-iterator/go Signed-off-by: Bo-Yi Wu --- binding/json.go | 3 ++- errors.go | 3 ++- errors_test.go | 2 +- render/json.go | 3 ++- vendor/vendor.json | 6 ++++++ 5 files changed, 13 insertions(+), 4 deletions(-) diff --git a/binding/json.go b/binding/json.go index 486b9733..aa7039d3 100644 --- a/binding/json.go +++ b/binding/json.go @@ -5,8 +5,9 @@ package binding import ( - "encoding/json" "net/http" + + json "github.com/json-iterator/go" ) type jsonBinding struct{} diff --git a/errors.go b/errors.go index f38d3ff1..19b2cfbe 100644 --- a/errors.go +++ b/errors.go @@ -6,9 +6,10 @@ package gin import ( "bytes" - "encoding/json" "fmt" "reflect" + + json "github.com/json-iterator/go" ) type ErrorType uint64 diff --git a/errors_test.go b/errors_test.go index 1aa0cdde..46ae536e 100644 --- a/errors_test.go +++ b/errors_test.go @@ -5,10 +5,10 @@ package gin import ( - "encoding/json" "errors" "testing" + json "github.com/json-iterator/go" "github.com/stretchr/testify/assert" ) diff --git a/render/json.go b/render/json.go index 8b64f533..38967409 100644 --- a/render/json.go +++ b/render/json.go @@ -6,8 +6,9 @@ package render import ( "bytes" - "encoding/json" "net/http" + + json "github.com/json-iterator/go" ) type JSON struct { diff --git a/vendor/vendor.json b/vendor/vendor.json index e520540b..547bb2e0 100644 --- a/vendor/vendor.json +++ b/vendor/vendor.json @@ -33,6 +33,12 @@ "revision": "5a0f697c9ed9d68fef0116532c6e05cfeae00e55", "revisionTime": "2017-06-01T23:02:30Z" }, + { + "checksumSHA1": "gWQ2ncPI6qpTwS3e6/ShPwUP1uo=", + "path": "github.com/json-iterator/go", + "revision": "b1afefe0580e6e818dd50da9593f477c80ccd67d", + "revisionTime": "2017-07-07T13:43:33Z" + }, { "checksumSHA1": "9if9IBLsxkarJ804NPWAzgskIAk=", "path": "github.com/manucorporat/stats",