mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
p2p/simulations: golint fixes
This commit is contained in:
parent
2fc81fca38
commit
7212a77c2d
1 changed files with 2 additions and 8 deletions
|
|
@ -698,12 +698,6 @@ func (s *Server) JSON(w http.ResponseWriter, status int, data interface{}) {
|
||||||
json.NewEncoder(w).Encode(data)
|
json.NewEncoder(w).Encode(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
type contextKey int
|
|
||||||
const (
|
|
||||||
keyNode contextKey = iota
|
|
||||||
keyPeer
|
|
||||||
)
|
|
||||||
|
|
||||||
// wrapHandler returns a httprouter.Handle which wraps a http.HandlerFunc by
|
// wrapHandler returns a httprouter.Handle which wraps a http.HandlerFunc by
|
||||||
// populating request.Context with any objects from the URL params
|
// populating request.Context with any objects from the URL params
|
||||||
func (s *Server) wrapHandler(handler http.HandlerFunc) httprouter.Handle {
|
func (s *Server) wrapHandler(handler http.HandlerFunc) httprouter.Handle {
|
||||||
|
|
@ -725,7 +719,7 @@ func (s *Server) wrapHandler(handler http.HandlerFunc) httprouter.Handle {
|
||||||
http.NotFound(w, req)
|
http.NotFound(w, req)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
ctx = context.WithValue(ctx, keyNode, node)
|
ctx = context.WithValue(ctx, "node", node)
|
||||||
}
|
}
|
||||||
|
|
||||||
if id := params.ByName("peerid"); id != "" {
|
if id := params.ByName("peerid"); id != "" {
|
||||||
|
|
@ -740,7 +734,7 @@ func (s *Server) wrapHandler(handler http.HandlerFunc) httprouter.Handle {
|
||||||
http.NotFound(w, req)
|
http.NotFound(w, req)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
ctx = context.WithValue(ctx, keyPeer, peer)
|
ctx = context.WithValue(ctx, "peer", peer)
|
||||||
}
|
}
|
||||||
|
|
||||||
handler(w, req.WithContext(ctx))
|
handler(w, req.WithContext(ctx))
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue