Skip to content

Commit

Permalink
Fixing go proto template for new changes
Browse files Browse the repository at this point in the history
Signed-off-by: Shivansh Vij <[email protected]>
  • Loading branch information
ShivanshVij committed Oct 12, 2023
1 parent 2bcf53a commit 97b7762
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
8 changes: 3 additions & 5 deletions generator/golang/templates/decode.templ
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,12 @@ func (x *{{ CamelCase .FullName }}) Decode (b []byte) error {
if x == nil {
return NilDecode
}
d := polyglot.GetDecoder(b)
defer d.Return()
return x.decode(d)
return x.decode(polyglot.Decoder(b))
}
{{end}}

{{define "internalDecode"}}
func (x *{{CamelCase .FullName}}) decode(d *polyglot.Decoder) error {
func (x *{{CamelCase .FullName}}) decode(d *polyglot.BufferDecoder) error {
if d.Nil() {
return nil
}
Expand All @@ -24,7 +22,7 @@ var err error
{{ range $field := $decoding.Other -}}
{{ $decoder := GetLUTDecoder $field.Kind -}}
{{ if eq $field.Kind 12 -}} {{/* protoreflect.BytesKind */ -}}
x.{{ CamelCaseName $field.Name }}, err = d{{ $decoder }}(nil)
x.{{ CamelCaseName $field.Name }}, err = d{{ $decoder }}(x.{{ CamelCaseName $field.Name }})
{{ else if eq $field.Kind 14 -}} {{/* protoreflect.EnumKind */ -}}
var {{ CamelCaseName $field.Name }}Temp uint32
{{ CamelCaseName $field.Name }}Temp, err = d{{ $decoder }}()
Expand Down
2 changes: 1 addition & 1 deletion generator/golang/templates/decodeMap.templ
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{define "decodeMap"}}
func (x {{CamelCase .FullName}}Map) decode(d *polyglot.Decoder, size uint32) error {
func (x {{CamelCase .FullName}}Map) decode(d *polyglot.BufferDecoder, size uint32) error {
if size == 0 {
return nil
}
Expand Down

0 comments on commit 97b7762

Please sign in to comment.