-
-
Notifications
You must be signed in to change notification settings - Fork 245
Open
Description
Isn't int64 supposed to be properly decoded ?
code:
package main
import (
"bytes"
"encoding/json"
"github.com/vmihailenco/msgpack/v5"
)
type Test struct {
ID int64 `json:"id"`
}
func main() {
s := `{"id":10}`
var obj map[string]interface{}
err := json.Unmarshal([]byte(s), &obj)
if err != nil {
panic(err)
}
res, err := msgpack.Marshal(&obj)
if err != nil {
panic(err)
}
var publisher Test
var buf bytes.Buffer
buf.Write(res)
dec := msgpack.NewDecoder(&buf)
dec.SetCustomStructTag("json")
err = dec.Decode(&publisher)
if err != nil {
panic(err)
}
}output:
panic: msgpack: invalid code=cb decoding int64
goroutine 1 [running]:
main.main()
/wherever/main.go:32 +0x108
exit status 2
version:
require github.com/vmihailenco/msgpack/v5 v5.4.1
Metadata
Metadata
Assignees
Labels
No labels