summaryrefslogtreecommitdiff
path: root/src/bytes
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
commit6448a7e7ced979271a09dd99895b52a997c5cdb3 (patch)
treed7edc5143f5a6f7ed3d2021e296def04795f9056 /src/bytes
parent27c07e1fbed9bf50ef1bb64cbfa81c28b317e813 (diff)
downloadgo-6448a7e7ced979271a09dd99895b52a997c5cdb3.tar.gz
bytes, strings: document that FieldsFunc f must not be stateful
Fixes issue 8738. LGTM=adg R=golang-codereviews, adg CC=golang-codereviews https://codereview.appspot.com/143260045
Diffstat (limited to 'src/bytes')
-rw-r--r--src/bytes/bytes.go2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/bytes/bytes.go b/src/bytes/bytes.go
index 34c22bbfb..7634707b3 100644
--- a/src/bytes/bytes.go
+++ b/src/bytes/bytes.go
@@ -267,6 +267,8 @@ func Fields(s []byte) [][]byte {
// It splits the slice s at each run of code points c satisfying f(c) and
// returns a slice of subslices of s. If all code points in s satisfy f(c), or
// len(s) == 0, 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 []byte, f func(rune) bool) [][]byte {
n := 0
inField := false