net/http: delete unnecessary string concatenation

In the existing implementation, if pattern is an empty string,
program calls a panic with the message which is a concatenation of
"http: invalid pattern " and pattern.
In this case, pattern is an empty, so the commit removes
this concatenation and the trailing space.

Fixes: #21102

Change-Id: I49f58b52d835311a6ac642de871eb15646e48a54
Reviewed-on: https://go-review.googlesource.com/50350
Reviewed-by: Dmitri Shuralyov <shurcool@gmail.com>
Reviewed-by: Tom Bergan <tombergan@google.com>
Run-TryBot: Tom Bergan <tombergan@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
Naoki Kanatani 2017-07-21 00:35:31 +09:00 committed by Tom Bergan
parent a1371756c3
commit d6cada7fa4
1 changed files with 1 additions and 1 deletions

View File

@ -2265,7 +2265,7 @@ func (mux *ServeMux) Handle(pattern string, handler Handler) {
defer mux.mu.Unlock()
if pattern == "" {
panic("http: invalid pattern " + pattern)
panic("http: invalid pattern")
}
if handler == nil {
panic("http: nil handler")