Skip to content

Commit bc21d6a

Browse files
futuristgopherbot
authored andcommitted
cmd/go/internal/modfetch: fix retractions slice initial length not zero
When make slice of retractions, it should have initial length zero, to append more VersionIntervals. Currently without the zero length, the capacity used will be doubled after the appending, looks like a bug. Change-Id: Id3acaeffe557ca1d15c864b0377a66fee3a41f6c GitHub-Last-Rev: ed5fd5f GitHub-Pull-Request: #60354 Reviewed-on: https://go-review.googlesource.com/c/go/+/497118 Auto-Submit: Bryan Mills <[email protected]> Reviewed-by: Bryan Mills <[email protected]> Run-TryBot: Bryan Mills <[email protected]> TryBot-Result: Gopher Robot <[email protected]> Reviewed-by: Dmitri Shuralyov <[email protected]>
1 parent 261e267 commit bc21d6a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/cmd/go/internal/modfetch/coderepo.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1013,7 +1013,7 @@ func (r *codeRepo) retractedVersions(ctx context.Context) (func(string) bool, er
10131013
if err != nil {
10141014
return nil, err
10151015
}
1016-
retractions := make([]modfile.VersionInterval, len(f.Retract))
1016+
retractions := make([]modfile.VersionInterval, 0, len(f.Retract))
10171017
for _, r := range f.Retract {
10181018
retractions = append(retractions, r.VersionInterval)
10191019
}

0 commit comments

Comments
 (0)