From 198c3cb785282ee4c199680ec2d05381805a6f66 Mon Sep 17 00:00:00 2001 From: Alan Donovan Date: Wed, 11 Dec 2024 15:42:06 -0500 Subject: std: pass bytes.Buffer and strings.Builder by pointer This CL fixes a number of (all true positive) findings of vet's copylock analyzer patched to treat the Bu{ff,uild}er types as non-copyable after first use. This does require imposing an additional indirection between noder.writer and Encoder since the field is embedded by value but its constructor now returns a pointer. Updates golang/go#25907 Updates golang/go#47276 Change-Id: I0b4d77ac12bcecadf06a91709e695365da10766c Reviewed-on: https://go-review.googlesource.com/c/go/+/635339 Reviewed-by: Robert Findley Commit-Queue: Alan Donovan LUCI-TryBot-Result: Go LUCI Auto-Submit: Alan Donovan --- src/bytes/buffer_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/bytes/buffer_test.go') diff --git a/src/bytes/buffer_test.go b/src/bytes/buffer_test.go index 97fca5a9d1..b46ba1204e 100644 --- a/src/bytes/buffer_test.go +++ b/src/bytes/buffer_test.go @@ -354,7 +354,7 @@ func TestWriteAppend(t *testing.T) { got.Write(b) } if !Equal(got.Bytes(), want) { - t.Fatalf("Bytes() = %q, want %q", got, want) + t.Fatalf("Bytes() = %q, want %q", &got, want) } // With a sufficiently sized buffer, there should be no allocations. -- cgit v1.3