Go version
go version 1.25.1
Output of go env
in your module/workspace:
N/A
What did you do?
I noticed in the function documentation for strings.FieldsFunc
it refers to SplitFunc
when describing the behaviour of the function. https://pkg.go.dev/strings#FieldsFunc
What did you see happen?
This function does not exist in this package, there is a type https://pkg.go.dev/bufio#SplitFunc, however I do not think this makes sense in the context.
This seems to be an oversight as it is mirroring the documentation of the Fields
function, which correctly refers to the behaviour of Split
.
What did you expect to see?
For symmetry with the Fields*
functions in the strings
package, I'd expect to see a SplitFunc
, SplitFuncSeq
, SplitNFunc
, SplitNFuncSeq
, SplitAfterFunc
, SplitAfterFuncSeq
, SplitAfterNFunc
, SplitAfterNFuncSeq
Comment From: tobyb121
Thinking a bit more about this, Func
variants of Split
would behave differently from Split
, as they apply per-rune rather than on a separator string, so it probably makes sense to just fix the documentation here.
Comment From: gabyhelp
Related Issues
- strings: Undocumented behavior of strings.FieldsFunc #12351 (closed)
- strings: FieldFunc behaves differently from Split #72841 (closed)
- strings, bytes: divergent documentation for FieldsFunc functions #38630 (closed)
- missing type in strings package s #24134 (closed)
(Emoji vote if this was helpful or unhelpful; more detailed feedback welcome in this discussion.)
Comment From: seankhliao
ah yes it should refer to just split
Comment From: gopherbot
Change https://go.dev/cl/703675 mentions this issue: bytes,strings: remove reference to non-existent SplitFunc
Comment From: TapirLiu
The doc build process should detect such broken links automatically.