Fix protogen empty messages marshaling #108

Merged
fyrchik merged 2 commits from fyrchik/frostfs-api-go:protogen-compat into master 2024-09-04 19:51:17 +00:00
18 changed files with 1 additions and 2 deletions
Showing only changes of commit 5fece80b42 - Show all commits

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -111,7 +111,6 @@ func testCompatibility(t *testing.T, msgGen func(empty bool) message.Message) {
} }
} }
t.Run("empty", func(t *testing.T) { t.Run("empty", func(t *testing.T) {
t.Skip()
msg := msgGen(true) msg := msgGen(true)
t.Run(fmt.Sprintf("Binary_%T", msg), func(t *testing.T) { t.Run(fmt.Sprintf("Binary_%T", msg), func(t *testing.T) {
compareBinary(t, msg) compareBinary(t, msg)

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -174,7 +174,7 @@ func emitMarshalRaw(g *protogen.GeneratedFile, f *protogen.Field, name string) {
name += "[i]" name += "[i]"
} }
g.P("if ", notNil(name), " && ", name, ".StableSize() != 0 {") g.P("if ", notNil(name), " {")
g.P(name, ".EmitProtobuf(mm.AppendMessage(", f.Desc.Number(), "))") g.P(name, ".EmitProtobuf(mm.AppendMessage(", f.Desc.Number(), "))")
g.P("}") g.P("}")
return return