]> Cypherpunks.ru repositories - gostls13.git/commit
slices: consistently use S ~[]E
authorIan Lance Taylor <iant@golang.org>
Tue, 13 Jun 2023 16:46:50 +0000 (09:46 -0700)
committerGopher Robot <gobot@golang.org>
Wed, 14 Jun 2023 17:09:34 +0000 (17:09 +0000)
commit0a48e5cbfabd679eecdec1efa731692cd6babf83
tree50f1d76e401a530536c40af010459bc08fad0d69
parent01b649b7ef45b89610a47efa048b8e73e76b078e
slices: consistently use S ~[]E

Make all functions use a constraint S ~[]E even if they don't return
the slice type. This makes explicitly instantiating the functions more
consistent: you don't have to remember which take ~[]E and which do not.
It also permits inferring the type when passing one of these functions
to some other function that is using a named slice type.

Fixes #60546

Change-Id: Ib3435255d0177fdbf03455ae527d08599b1ce012
Reviewed-on: https://go-review.googlesource.com/c/go/+/502955
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Axel Wagner <axel.wagner.hh@googlemail.com>
Reviewed-by: Eli Bendersky <eliben@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
api/go1.21.txt
src/slices/slices.go
src/slices/slices_test.go
src/slices/sort.go