Skip to content

Commit

Permalink
Merge branch 'main' into feat/clone-pool
Browse files Browse the repository at this point in the history
  • Loading branch information
vmg committed Sep 20, 2023
2 parents c86038c + b133c9c commit d8cddbe
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 25 deletions.
2 changes: 2 additions & 0 deletions features/pool/pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ func (p *pool) message(message *protogen.Message) {
p.P(`}`)

p.P(`func (m *`, ccTypeName, `) ResetVT() {`)
p.P(`if m != nil {`)
var saved []*protogen.Field
for _, field := range message.Fields {
fieldName := field.GoName
Expand Down Expand Up @@ -89,6 +90,7 @@ func (p *pool) message(message *protogen.Message) {
p.P(`m.`, field.GoName, ` = `, fmt.Sprintf("f%d", i))
}
p.P(`}`)
p.P(`}`)

p.P(`func (m *`, ccTypeName, `) ReturnToVTPool() {`)
p.P(`if m != nil {`)
Expand Down
4 changes: 3 additions & 1 deletion testproto/pool/pool_vtproto.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

42 changes: 26 additions & 16 deletions testproto/pool/pool_with_oneof_vtproto.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 12 additions & 8 deletions testproto/pool/pool_with_slice_reuse_vtproto.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit d8cddbe

Please sign in to comment.