Skip to content

Commit 8b03a39

Browse files
extemporalgenomebradfitz
authored andcommitted
net/http: make docs refer to Context.Value as a getter instead of context.WithValue
The doc comments of both ServerContextKey and LocalAddrContextKey both suggest that context.WithValue can be used to access (get) properties of the server or connection. This PR fixes those comments to refer to Context.Value instead. Change-Id: I4ed383ef97ba1951f90c555243007469cfc18d4d GitHub-Last-Rev: 05bc3ac GitHub-Pull-Request: #33833 Reviewed-on: https://go-review.googlesource.com/c/go/+/191838 Reviewed-by: Brad Fitzpatrick <[email protected]>
1 parent 78f6856 commit 8b03a39

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/net/http/server.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,13 +231,13 @@ type CloseNotifier interface {
231231

232232
var (
233233
// ServerContextKey is a context key. It can be used in HTTP
234-
// handlers with context.WithValue to access the server that
234+
// handlers with Context.Value to access the server that
235235
// started the handler. The associated value will be of
236236
// type *Server.
237237
ServerContextKey = &contextKey{"http-server"}
238238

239239
// LocalAddrContextKey is a context key. It can be used in
240-
// HTTP handlers with context.WithValue to access the local
240+
// HTTP handlers with Context.Value to access the local
241241
// address the connection arrived on.
242242
// The associated value will be of type net.Addr.
243243
LocalAddrContextKey = &contextKey{"local-addr"}

0 commit comments

Comments
 (0)