From 6e16ab497341f269d59d3a6bc340a8cba48aafda Mon Sep 17 00:00:00 2001 From: Patrick O'Grady Date: Mon, 23 Nov 2020 10:00:13 -0800 Subject: [PATCH] Update msgpack --- go.mod | 2 +- go.sum | 4 ++-- storage/encoder.go | 8 ++++++-- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/go.mod b/go.mod index f61cd65d..076a3394 100644 --- a/go.mod +++ b/go.mod @@ -21,7 +21,7 @@ require ( github.com/stretchr/testify v1.6.1 github.com/tidwall/gjson v1.6.3 github.com/tidwall/sjson v1.1.2 - github.com/vmihailenco/msgpack/v5 v5.0.0-beta.9 + github.com/vmihailenco/msgpack/v5 v5.0.0 golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a // indirect golang.org/x/net v0.0.0-20200904194848-62affa334b73 // indirect golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208 diff --git a/go.sum b/go.sum index 68e3366e..152d070d 100644 --- a/go.sum +++ b/go.sum @@ -265,8 +265,8 @@ github.com/tidwall/sjson v1.1.2/go.mod h1:SEzaDwxiPzKzNfUEO4HbYF/m4UCSJDsGgNqsS1 github.com/tyler-smith/go-bip39 v1.0.1-0.20181017060643-dbb3b84ba2ef/go.mod h1:sJ5fKU0s6JVwZjjcUEX2zFOnvq0ASQ2K9Zr6cf67kNs= github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= -github.com/vmihailenco/msgpack/v5 v5.0.0-beta.9 h1:iBRIniTnWOo0kqkg3k3XR8Vn6OCkVlIuZNo0UoBrKx4= -github.com/vmihailenco/msgpack/v5 v5.0.0-beta.9/go.mod h1:HVxBVPUK/+fZMonk4bi1islLa8V3cfnBug0+4dykPzo= +github.com/vmihailenco/msgpack/v5 v5.0.0 h1:nCaMMPEyfgwkGc/Y0GreJPhuvzqCqW+Ufq5lY7zLO2c= +github.com/vmihailenco/msgpack/v5 v5.0.0/go.mod h1:HVxBVPUK/+fZMonk4bi1islLa8V3cfnBug0+4dykPzo= github.com/vmihailenco/tagparser v0.1.2 h1:gnjoVuB/kljJ5wICEEOpx98oXMWPLj22G67Vbd1qPqc= github.com/vmihailenco/tagparser v0.1.2/go.mod h1:OeAg3pn3UbLjkWt+rN9oFYB6u/cQgqMEUPoW2WPyhdI= github.com/wsddn/go-ecdh v0.0.0-20161211032359-48726bab9208/go.mod h1:IotVbo4F+mw0EzQ08zFqg7pK3FebNXpaMsRy2RT+Ees= diff --git a/storage/encoder.go b/storage/encoder.go index c0c1e489..0f9e3185 100644 --- a/storage/encoder.go +++ b/storage/encoder.go @@ -30,6 +30,10 @@ import ( msgpack "github.com/vmihailenco/msgpack/v5" ) +const ( + jsonTag = "json" +) + // Encoder handles the encoding/decoding of structs and the // compression/decompression of data using zstd. Optionally, // the caller can provide a map of dicts on initialization that @@ -84,7 +88,7 @@ func NewEncoder( func getEncoder(w io.Writer) *msgpack.Encoder { enc := msgpack.NewEncoder(w) - enc.UseJSONTag(true) + enc.SetCustomStructTag(jsonTag) return enc } @@ -119,7 +123,7 @@ func (e *Encoder) EncodeRaw(namespace string, input []byte) ([]byte, error) { func getDecoder(r io.Reader) *msgpack.Decoder { dec := msgpack.NewDecoder(r) - dec.UseJSONTag(true) + dec.SetCustomStructTag(jsonTag) return dec }