From 2cea6cdb6016708e89c9472cdb0504731699681d Mon Sep 17 00:00:00 2001 From: David Chase Date: Thu, 10 Nov 2022 11:45:23 -0500 Subject: [PATCH] cmd/internal/obj: adjust (*Link).AllPos comment in inl.go AllPos truncates and overwrites its slice-storage input instead of appending. This makes that clear. Change-Id: I81653ff49a4a7d14fe9446fd6620943f3b20bbd3 Reviewed-on: https://go-review.googlesource.com/c/go/+/449478 TryBot-Result: Gopher Robot Reviewed-by: Keith Randall Run-TryBot: David Chase Reviewed-by: Keith Randall --- src/cmd/internal/obj/inl.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/cmd/internal/obj/inl.go b/src/cmd/internal/obj/inl.go index de3c73d693..934f1c2657 100644 --- a/src/cmd/internal/obj/inl.go +++ b/src/cmd/internal/obj/inl.go @@ -109,8 +109,9 @@ func (ctxt *Link) InnermostPos(xpos src.XPos) src.Pos { } // AllPos returns a slice of the positions inlined at xpos, from -// innermost (index zero) to outermost. To avoid gratuitous allocation -// the result is passed in and extended if necessary. +// innermost (index zero) to outermost. To avoid allocation +// the input slice is truncated, and used for the result, extended +// as necessary. func (ctxt *Link) AllPos(xpos src.XPos, result []src.Pos) []src.Pos { pos := ctxt.InnermostPos(xpos) result = result[:0] -- 2.50.0