From 7212a77c2da9c0c6ab1cf7ad7ee74c5c542f3dc5 Mon Sep 17 00:00:00 2001 From: Mike Kinney Date: Mon, 9 Dec 2019 22:56:40 -0800 Subject: [PATCH] p2p/simulations: golint fixes --- p2p/simulations/http.go | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/p2p/simulations/http.go b/p2p/simulations/http.go index b1a39d58b0..44f36de280 100644 --- a/p2p/simulations/http.go +++ b/p2p/simulations/http.go @@ -698,12 +698,6 @@ func (s *Server) JSON(w http.ResponseWriter, status int, data interface{}) { json.NewEncoder(w).Encode(data) } -type contextKey int -const ( - keyNode contextKey = iota - keyPeer -) - // wrapHandler returns a httprouter.Handle which wraps a http.HandlerFunc by // populating request.Context with any objects from the URL params 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) return } - ctx = context.WithValue(ctx, keyNode, node) + ctx = context.WithValue(ctx, "node", node) } if id := params.ByName("peerid"); id != "" { @@ -740,7 +734,7 @@ func (s *Server) wrapHandler(handler http.HandlerFunc) httprouter.Handle { http.NotFound(w, req) return } - ctx = context.WithValue(ctx, keyPeer, peer) + ctx = context.WithValue(ctx, "peer", peer) } handler(w, req.WithContext(ctx))