Browse Source

render: update msgpack usage (#1498)

please see msgpack usage: https://github.com/ugorji/go/tree/master/codec#usage
田欧 7 năm trước cách đây
mục cha
commit
32b58e0fd2
1 tập tin đã thay đổi với 2 bổ sung2 xóa
  1. 2 2
      render/msgpack.go

+ 2 - 2
render/msgpack.go

@@ -26,6 +26,6 @@ func (r MsgPack) Render(w http.ResponseWriter) error {
 
 
 func WriteMsgPack(w http.ResponseWriter, obj interface{}) error {
 func WriteMsgPack(w http.ResponseWriter, obj interface{}) error {
 	writeContentType(w, msgpackContentType)
 	writeContentType(w, msgpackContentType)
-	var h codec.Handle = new(codec.MsgpackHandle)
-	return codec.NewEncoder(w, h).Encode(obj)
+	var mh codec.MsgpackHandle
+	return codec.NewEncoder(w, &mh).Encode(obj)
 }
 }