diff --git a/_generated/def.go b/_generated/def.go index dc3ec3f4..16333171 100644 --- a/_generated/def.go +++ b/_generated/def.go @@ -31,6 +31,7 @@ type X struct { Others [][32]int32 // should compile to len(x.Others)*32*msgp.Int32Size Matrix [][]int32 // should not optimize ManyFixed []Fixed + WeirdTag string `msg:"\x0b"` } // test fixed-size struct diff --git a/gen/decode.go b/gen/decode.go index 55977d4a..4ad91e8d 100644 --- a/gen/decode.go +++ b/gen/decode.go @@ -128,7 +128,7 @@ func (d *decodeGen) structAsMap(s *Struct) { d.p.print("\nswitch msgp.UnsafeString(field) {") for i := range s.Fields { d.ctx.PushString(s.Fields[i].FieldName) - d.p.printf("\ncase \"%s\":", s.Fields[i].FieldTag) + d.p.printf("\ncase %q:", s.Fields[i].FieldTag) fieldElem := s.Fields[i].FieldElem anField := s.Fields[i].HasTagPart("allownil") && fieldElem.AllowNil() if anField { diff --git a/gen/unmarshal.go b/gen/unmarshal.go index 37e066fd..76323854 100644 --- a/gen/unmarshal.go +++ b/gen/unmarshal.go @@ -127,7 +127,7 @@ func (u *unmarshalGen) mapstruct(s *Struct) { if !u.p.ok() { return } - u.p.printf("\ncase \"%s\":", s.Fields[i].FieldTag) + u.p.printf("\ncase %q:", s.Fields[i].FieldTag) u.ctx.PushString(s.Fields[i].FieldName) fieldElem := s.Fields[i].FieldElem