Find these replacements through https://pkg.go.dev/golang.org/x/tools/gopls/internal/analysis/modernize.
Change-Id: If88fe0e109b7c7557bfb3d3ffc15271af1ab5856
Reviewed-on: https://go-review.googlesource.com/c/go/+/668437
Reviewed-by: Sean Liao <sean@liao.dev>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Sean Liao <sean@liao.dev>
Reviewed-by: David Chase <drchase@google.com>
}
b := make([]byte, 256)
- for _, m := range strings.Fields("A long time ago in a galaxy far, far away...") {
+ for m := range strings.FieldsSeq("A long time ago in a galaxy far, far away...") {
// We use a simple framing format where the first byte is the
// message length, followed the message itself.
b[0] = uint8(copy(b[1:], m))
}
// Split on newlines.
- cl := strings.Split(c, "\n")
+ cl := strings.SplitSeq(c, "\n")
// Walk lines, stripping trailing white space and adding to list.
- for _, l := range cl {
+ for l := range cl {
lines = append(lines, stripTrailingWhitespace(l))
}
}
func parseLines(src []byte, parse func([]byte) (map[string]any, error)) ([]map[string]any, error) {
var records []map[string]any
- for _, line := range bytes.Split(src, []byte{'\n'}) {
+ for line := range bytes.SplitSeq(src, []byte{'\n'}) {
if len(line) == 0 {
continue
}