aboutsummaryrefslogtreecommitdiff
path: root/src/strings
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2014-09-18 19:40:31 -0400
committerRuss Cox <rsc@golang.org>2014-09-18 19:40:31 -0400
commite9ec8e7a2693b322287a96100750c6f00cf574ef (patch)
treedf5e1be79fba71beb2b668e37de62501484ef3f4 /src/strings
parentab76638cdc1705ec4f22cb6f757c1b542b388692 (diff)
downloadgo-e9ec8e7a2693b322287a96100750c6f00cf574ef.tar.xz
bytes, strings: document that FieldsFunc f must not be stateful
Fixes #8738. LGTM=adg R=golang-codereviews, adg CC=golang-codereviews https://golang.org/cl/143260045
Diffstat (limited to 'src/strings')
-rw-r--r--src/strings/strings.go2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/strings/strings.go b/src/strings/strings.go
index 761f32a068..1b9df2e757 100644
--- a/src/strings/strings.go
+++ b/src/strings/strings.go
@@ -347,6 +347,8 @@ func Fields(s string) []string {
// FieldsFunc splits the string s at each run of Unicode code points c satisfying f(c)
// and returns an array of slices of s. If all code points in s satisfy f(c) or the
// string is empty, an empty slice is returned.
+// FieldsFunc makes no guarantees about the order in which it calls f(c).
+// If f does not return consistent results for a given c, FieldsFunc may crash.
func FieldsFunc(s string, f func(rune) bool) []string {
// First count the fields.
n := 0