]> Cypherpunks repositories - gostls13.git/commitdiff
net/http: delete unnecessary string concatenation
authorNaoki Kanatani <k12naoki@gmail.com>
Thu, 20 Jul 2017 15:35:31 +0000 (00:35 +0900)
committerTom Bergan <tombergan@google.com>
Tue, 15 Aug 2017 23:29:17 +0000 (23:29 +0000)
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>

src/net/http/server.go

index e5ac252a68edbecea5b6d2f2d12c27ea78d1c243..8af4438262ef1e19034bad1c256dd379294149cc 100644 (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")