From 5fee159bc2e60736ce967560ee5be738fe5d5bd2 Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Tue, 21 May 2024 23:02:51 -0400 Subject: all: document legacy //go:linkname for modules with ≥50,000 dependents MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Note that this depends on the revert of CL 581395 to move zeroVal back. For #67401. Change-Id: I507c27c2404ad1348aabf1ffa3740e6b1957495b Reviewed-on: https://go-review.googlesource.com/c/go/+/587217 LUCI-TryBot-Result: Go LUCI Auto-Submit: Russ Cox Reviewed-by: Cherry Mui --- src/runtime/slice.go | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/runtime/slice.go') diff --git a/src/runtime/slice.go b/src/runtime/slice.go index 4fbe056b78..3439a0d751 100644 --- a/src/runtime/slice.go +++ b/src/runtime/slice.go @@ -152,6 +152,16 @@ func makeslice64(et *_type, len64, cap64 int64) unsafe.Pointer { // new length so that the old length is not live (does not need to be // spilled/restored) and the new length is returned (also does not need // to be spilled/restored). +// +// growslice should be an internal detail, +// but widely used packages access it using linkname. +// Notable members of the hall of shame include: +// - github.com/ugorji/go/codec +// +// Do not remove or change the type signature. +// See go.dev/issue/67401. +// +//go:linkname growslice func growslice(oldPtr unsafe.Pointer, newLen, oldCap, num int, et *_type) slice { oldLen := newLen - num if raceenabled { -- cgit v1.3-5-g9baa