mirror of
https://github.com/golang/go
synced 2024-09-05 16:04:50 +00:00
doc: change variable name in Effective Go
Effective Go has references to a function call f(c, req) made by ServeHTTP mixed with f(w, req). c is dropped in favor of w to maintain consistency Fixes #17128 Change-Id: I6746fd115ed5a58971fd24e54024d29d18ead1fa Reviewed-on: https://go-review.googlesource.com/29311 Reviewed-by: Rob Pike <r@golang.org>
This commit is contained in:
parent
e727e37090
commit
e888b81a11
|
@ -2409,7 +2409,7 @@ The <code>http</code> package contains this code:
|
|||
// Handler object that calls f.
|
||||
type HandlerFunc func(ResponseWriter, *Request)
|
||||
|
||||
// ServeHTTP calls f(c, req).
|
||||
// ServeHTTP calls f(w, req).
|
||||
func (f HandlerFunc) ServeHTTP(w ResponseWriter, req *Request) {
|
||||
f(w, req)
|
||||
}
|
||||
|
@ -2447,7 +2447,7 @@ the handler installed at that page has value <code>ArgServer</code>
|
|||
and type <code>HandlerFunc</code>.
|
||||
The HTTP server will invoke the method <code>ServeHTTP</code>
|
||||
of that type, with <code>ArgServer</code> as the receiver, which will in turn call
|
||||
<code>ArgServer</code> (via the invocation <code>f(c, req)</code>
|
||||
<code>ArgServer</code> (via the invocation <code>f(w, req)</code>
|
||||
inside <code>HandlerFunc.ServeHTTP</code>).
|
||||
The arguments will then be displayed.
|
||||
</p>
|
||||
|
|
Loading…
Reference in a new issue