Browse Source

client: Replace ugorji/codec with json-iterator/go

We need to use the stdlib-compatible one that is case-sensitive, etc

Change-Id: Id0df573a70e09967ac7d8c0a63d99d6a49ce82f1
Davanum Srinivas 6 years ago
parent
commit
90108a2e61
3 changed files with 5 additions and 2 deletions
  1. 3 2
      client/keys.go
  2. 1 0
      go.mod
  3. 1 0
      go.sum

+ 3 - 2
client/keys.go

@@ -27,7 +27,7 @@ import (
 	"strings"
 	"time"
 
-	"github.com/ugorji/go/codec"
+	jsoniter "github.com/json-iterator/go"
 	"go.etcd.io/etcd/pkg/pathutil"
 )
 
@@ -658,7 +658,8 @@ func unmarshalHTTPResponse(code int, header http.Header, body []byte) (res *Resp
 
 func unmarshalSuccessfulKeysResponse(header http.Header, body []byte) (*Response, error) {
 	var res Response
-	err := codec.NewDecoderBytes(body, new(codec.JsonHandle)).Decode(&res)
+	var json = jsoniter.ConfigCompatibleWithStandardLibrary
+	err := json.Unmarshal(body, &res)
 	if err != nil {
 		return nil, ErrInvalidJSON
 	}

+ 1 - 0
go.mod

@@ -23,6 +23,7 @@ require (
 	github.com/grpc-ecosystem/grpc-gateway v1.4.1
 	github.com/inconshreveable/mousetrap v1.0.0 // indirect
 	github.com/jonboulle/clockwork v0.1.0
+	github.com/json-iterator/go v1.1.5 // indirect
 	github.com/kr/pty v1.0.0
 	github.com/mattn/go-colorable v0.0.9 // indirect
 	github.com/mattn/go-isatty v0.0.4 // indirect

+ 1 - 0
go.sum

@@ -46,6 +46,7 @@ github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NH
 github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
 github.com/jonboulle/clockwork v0.1.0 h1:VKV+ZcuP6l3yW9doeqz6ziZGgcynBVQO+obU0+0hcPo=
 github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo=
+github.com/json-iterator/go v1.1.5/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
 github.com/kr/pty v1.0.0 h1:jR04h3bskdxb8xt+5B6MoxPwDhMCe0oEgxug4Ca1YSA=
 github.com/kr/pty v1.0.0/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
 github.com/mattn/go-colorable v0.0.9 h1:UVL0vNpWh04HeJXV0KLcaT7r06gOH2l4OW6ddYRUIY4=