Skip to content

Commit 61e0cac

Browse files
committed
strings: document that NewReplacer can panic
Fixes #31233 Change-Id: I2831d5e6532d3f4ed7eb99af5d6e0e1a41ebac9a Reviewed-on: https://go-review.googlesource.com/c/go/+/170624 Reviewed-by: Andrew Bonventre <[email protected]>
1 parent f33b67b commit 61e0cac

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/strings/replace.go

+2
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ type replacer interface {
2626
// NewReplacer returns a new Replacer from a list of old, new string
2727
// pairs. Replacements are performed in the order they appear in the
2828
// target string, without overlapping matches.
29+
//
30+
// NewReplacer panics if given an odd number of arguments.
2931
func NewReplacer(oldnew ...string) *Replacer {
3032
if len(oldnew)%2 == 1 {
3133
panic("strings.NewReplacer: odd argument count")

0 commit comments

Comments
 (0)