generate: Use new option type
This commit is contained in:
parent
62e3c7814c
commit
5d5ee9c644
@ -222,6 +222,12 @@ func (this *Protocol) unmarshalMessage(out io.Writer, message Message) error {
|
|||||||
fmt.Fprintf(out,
|
fmt.Fprintf(out,
|
||||||
"func (msg *Message%s) UnmarshalBinary(buffer []byte) error {\n",
|
"func (msg *Message%s) UnmarshalBinary(buffer []byte) error {\n",
|
||||||
message.Name)
|
message.Name)
|
||||||
|
if len(message.Fields) < 1 {
|
||||||
|
fmt.Fprintf(out, "\t// no fields\n")
|
||||||
|
fmt.Fprintf(out, "\treturn nil\n")
|
||||||
|
fmt.Fprintf(out, "}\n\n")
|
||||||
|
return nil
|
||||||
|
}
|
||||||
fmt.Fprintf(out, "\tpairs, err := tape.DecodePairs(buffer)\n")
|
fmt.Fprintf(out, "\tpairs, err := tape.DecodePairs(buffer)\n")
|
||||||
fmt.Fprintf(out, "\tif err != nil { return err }\n")
|
fmt.Fprintf(out, "\tif err != nil { return err }\n")
|
||||||
requiredTotal := 0
|
requiredTotal := 0
|
||||||