A slice expression of the form:
s[a:len(s)]
will be simplified to:
s[a:]
This is one of the simplifications that "gofmt -s" applies.
See https://pkg.go.dev/golang.org/x/tools/gopls/internal/analysis/simplifyslice
Change-Id: Ib3c01ecf24b84333fd1993a343450fc57fb8ac84
Reviewed-on: https://go-review.googlesource.com/c/go/+/575335
Reviewed-by: Ian Lance Taylor <iant@google.com>
Commit-Queue: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Valentin Deleplace <deleplace@google.com>
if j == len(s) {
s2 := append(s[:i], v...)
if len(s2) < len(s) {
- clear(s[len(s2):len(s)]) // zero/nil out the obsolete elements, for GC
+ clear(s[len(s2):]) // zero/nil out the obsolete elements, for GC
}
return s2
}