Skip to content

Commit

Permalink
Set len of byte slice rather than cap
Browse files Browse the repository at this point in the history
Signed-off-by: Matt Lord <[email protected]>
  • Loading branch information
mattlord committed Oct 16, 2024
1 parent ec27f82 commit fedf867
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion go/vt/servenv/grpc_codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func (c *Codec) Marshal(v any) (mem.BufferSlice, error) {
if m, ok := v.(vtprotoMessage); ok {
size := m.SizeVT()
if mem.IsBelowBufferPoolingThreshold(size) {
buf := make([]byte, 0, size)
buf := make([]byte, size)
if _, err := m.MarshalToSizedBufferVT(buf[:size]); err != nil {
return nil, err
}
Expand Down

0 comments on commit fedf867

Please sign in to comment.