If optimized encoders and decoders for the types S and T in the following code are generated via codecgen then the function Bug prints malformed JSON {"t":} without error.
package bug
//go:generate codecgen -o codec.generated.go -d 9552 data.go
type S struct {
T T `json:"t"`
}
type T struct {
JRM json.RawMessage
}
func Bug() {
s := S{
T: T{
JRM: json.RawMessage{0x37, 0x38, 0x33},
},
}
jsonHandle := new(codec.JsonHandle)
enc := codec.NewEncoder(os.Stdout, jsonHandle)
err := enc.Encode(s)
if err != nil {
panic(err)
}
}
Note that encoding s.T works properly and produces {"JRM":783}.
Note that the bug was not present in version 1.1.7
If optimized encoders and decoders for the types S and T in the following code are generated via codecgen then the function Bug prints malformed JSON
{"t":}
without error.Note that encoding
s.T
works properly and produces{"JRM":783}
.Note that the bug was not present in version 1.1.7