From: Jes Cok Date: Tue, 20 Jun 2023 11:35:10 +0000 (+0000) Subject: net/http: declare publicErr as a constant X-Git-Tag: go1.22rc1~1597 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=2b82d70f856b91bf278a28fd697b69811e1335eb;p=gostls13.git net/http: declare publicErr as a constant Do the same as the code above: "case err == errTooLarge", declare publicErr as a constant to avoid runtime calls. Change-Id: I50a9951232c70eff027b0da86c0bbb8bea51acbe GitHub-Last-Rev: 71d4458ded3a1e99a0d027ccca6c9d6269a1ab06 GitHub-Pull-Request: golang/go#60884 Reviewed-on: https://go-review.googlesource.com/c/go/+/504456 Reviewed-by: Damien Neil Reviewed-by: Ian Lance Taylor TryBot-Result: Gopher Robot Run-TryBot: Damien Neil Reviewed-by: Olif Oftimis --- diff --git a/src/net/http/server.go b/src/net/http/server.go index 8f63a90299..29e862d832 100644 --- a/src/net/http/server.go +++ b/src/net/http/server.go @@ -1971,7 +1971,7 @@ func (c *conn) serve(ctx context.Context) { fmt.Fprintf(c.rwc, "HTTP/1.1 %d %s: %s%s%d %s: %s", v.code, StatusText(v.code), v.text, errorHeaders, v.code, StatusText(v.code), v.text) return } - publicErr := "400 Bad Request" + const publicErr = "400 Bad Request" fmt.Fprintf(c.rwc, "HTTP/1.1 "+publicErr+errorHeaders+publicErr) return }