Commit 61e0cac2 authored by Brad Fitzpatrick's avatar Brad Fitzpatrick

strings: document that NewReplacer can panic

Fixes #31233

Change-Id: I2831d5e6532d3f4ed7eb99af5d6e0e1a41ebac9a
Reviewed-on: https://go-review.googlesource.com/c/go/+/170624Reviewed-by: default avatarAndrew Bonventre <andybons@golang.org>
parent f33b67b8
......@@ -26,6 +26,8 @@ type replacer interface {
// NewReplacer returns a new Replacer from a list of old, new string
// pairs. Replacements are performed in the order they appear in the
// target string, without overlapping matches.
//
// NewReplacer panics if given an odd number of arguments.
func NewReplacer(oldnew ...string) *Replacer {
if len(oldnew)%2 == 1 {
panic("strings.NewReplacer: odd argument count")
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment