From: Brad Fitzpatrick Date: Wed, 3 Apr 2019 19:38:11 +0000 (+0000) Subject: strings: document that NewReplacer can panic X-Git-Tag: go1.13beta1~809 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=61e0cac2988c29130417a323fd539604983854fb;p=gostls13.git 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 --- diff --git a/src/strings/replace.go b/src/strings/replace.go index ace0b8d646..ccab1fb861 100644 --- a/src/strings/replace.go +++ b/src/strings/replace.go @@ -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")