From 61e0cac2988c29130417a323fd539604983854fb Mon Sep 17 00:00:00 2001 From: Brad Fitzpatrick Date: Wed, 3 Apr 2019 19:38:11 +0000 Subject: [PATCH] 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 --- src/strings/replace.go | 2 ++ 1 file changed, 2 insertions(+) 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") -- 2.48.1