Cleanup / temp buffers for various things

This commit is contained in:
jdl
2026-06-12 14:16:38 +02:00
parent 6856727985
commit 4d2aa5c8c7
10 changed files with 30 additions and 17 deletions

View File

@@ -59,7 +59,8 @@ func TestRoundTrip(t *testing.T) {
for _, tc := range cases {
t.Run(tc.name, func(t *testing.T) {
buf := tc.ping.Marshal()
var buf [control.Size]byte
tc.ping.Marshal(buf[:])
got, err := control.Unmarshal(buf)
if err != nil {
t.Fatalf("Unmarshal: %v", err)
@@ -80,7 +81,8 @@ func TestUnmarshalBadVersion(t *testing.T) {
}
func TestZeroEncoding(t *testing.T) {
buf := (control.Ping{}).Marshal()
var buf [control.Size]byte
(control.Ping{}).Marshal(buf[:])
for i, b := range buf {
if i == 0 {
continue // version byte