1
0
mirror of https://github.com/golang/go synced 2024-11-18 14:34:39 -07:00
go/src/strings
Martin Möhrmann f2163c4d45 bytes, strings: align requirements for functions passed to FieldFuncs
golang.org/cl/229763 removed the documentation of requirements of
the function passed to FieldsFunc. The current implementation does
not require functions to return consistent results but this had not
been the case for previous implementations.

Add the requirement for consistent results back to the documentation
to allow for future implementations to be more allocation efficient
for an output with more than 32 fields. This is possible with a two
pass algorithm first determining the number of fields used to allocate
the output slice and then splitting the input into fields.

While at it align the documentation of bytes.FieldsFunc with
strings.FieldFunc.

Fixes #38630

Change-Id: Iabbf9ca3dff0daa41f4ec930a21a3dd98e19f122
Reviewed-on: https://go-review.googlesource.com/c/go/+/230797
Run-TryBot: Martin Möhrmann <moehrmann@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
2020-04-29 19:58:47 +00:00
..
builder_test.go strings: remove a redundant and flaky part of a test 2019-10-31 20:45:40 +00:00
builder.go cmd/compile: add -d=checkptr to validate unsafe.Pointer rules 2019-10-17 00:40:21 +00:00
compare_test.go strings: lower running time of TestCompareStrings 2018-11-04 18:55:55 +00:00
compare.go
example_test.go strings: clarify usage of Title and ToTitle 2019-07-30 02:52:57 +00:00
export_test.go
reader_test.go bytes, strings: fix Reader.UnreadRune returning without error on a zero Reader 2018-10-29 20:07:25 +00:00
reader.go bytes, strings: fix Reader.UnreadRune returning without error on a zero Reader 2018-10-29 20:07:25 +00:00
replace_test.go
replace.go strings: document that order of pairs matters in NewReplacer 2019-07-10 21:26:21 +00:00
search_test.go
search.go
strings_test.go strings, bytes: improve IndexAny and LastIndexAny performance 2020-03-11 05:13:13 +00:00
strings.go bytes, strings: align requirements for functions passed to FieldFuncs 2020-04-29 19:58:47 +00:00