Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export PROTOBUF_ROOT=$(PWD)/_vendor/protobuf-21.12
install: bin/protoc-gen-go-vtproto bin/protoc-gen-go

bin/protoc-gen-go-vtproto:
go install -tags protolegacy ./cmd/protoc-gen-go-vtproto
go install -buildvcs=false -tags protolegacy ./cmd/protoc-gen-go-vtproto

bin/protoc-gen-go:
go install -tags protolegacy google.golang.org/protobuf/cmd/protoc-gen-go
Expand Down
2 changes: 2 additions & 0 deletions features/pool/pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ func (p *pool) message(message *protogen.Message) {
p.P(`mm.Reset()`)
}
p.P(`}`)
case protoreflect.BytesKind, protoreflect.StringKind:
p.P(`clear(m.`, fieldName, `)`)
}
p.P(fmt.Sprintf("f%d", len(saved)), ` := m.`, fieldName, `[:0]`)
saved = append(saved, field)
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/planetscale/vtprotobuf

go 1.20
go 1.21

require (
github.com/stretchr/testify v1.8.4
Expand Down
1 change: 1 addition & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg
github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
Expand Down
1 change: 1 addition & 0 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.

74 changes: 68 additions & 6 deletions testproto/pool/pool_with_slice_reuse.pb.go

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

5 changes: 5 additions & 0 deletions testproto/pool/pool_with_slice_reuse.proto
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,9 @@ message Slice2 {
}
message Element2 {
int32 a = 1;
}

message Test3 {
option (vtproto.mempool) = true;
repeated bytes Sl = 1;
}
Loading