From 2a682dd7b08adcb8e7077d413adf456727ca6c04 Mon Sep 17 00:00:00 2001 From: Lorenzo Manacorda Date: Thu, 13 Oct 2016 14:25:28 +0200 Subject: [PATCH] Fix linter error for strings in context.WithValue --- app/router.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/router.go b/app/router.go index d468f3aa5..754b025c7 100644 --- a/app/router.go +++ b/app/router.go @@ -29,8 +29,13 @@ var ( UniqueID = "0" ) +// contextKey is a wrapper type for use in context.WithValue() to satisfy golint +// https://github.com/golang/go/issues/17293 +// https://github.com/golang/lint/pull/245 +type contextKey string + // RequestCtxKey is key used for request entry in context -const RequestCtxKey = "request" +const RequestCtxKey contextKey = contextKey("request") // CtxHandlerFunc is a http.HandlerFunc, with added contexts type CtxHandlerFunc func(context.Context, http.ResponseWriter, *http.Request)