From 3c40387733fe5551fa4cd5ea6eef294f76d1585a Mon Sep 17 00:00:00 2001 From: panshuai-ps Date: Fri, 17 Nov 2023 16:55:27 +0800 Subject: [PATCH] fix: lint --- pkg/search/storage/types.go | 6 +++--- pkg/util/filters/search_filter.go | 5 +++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/pkg/search/storage/types.go b/pkg/search/storage/types.go index a6559dcc..6c101daf 100644 --- a/pkg/search/storage/types.go +++ b/pkg/search/storage/types.go @@ -21,9 +21,9 @@ import ( ) const ( - Equals string = "=" - DSLPatternType = "dsl" - SQLPatternType = "sql" + Equals = "=" + DSLPatternType = "dsl" + SQLPatternType = "sql" ) type Storage interface { diff --git a/pkg/util/filters/search_filter.go b/pkg/util/filters/search_filter.go index 50d316a8..c2dcdf91 100644 --- a/pkg/util/filters/search_filter.go +++ b/pkg/util/filters/search_filter.go @@ -21,6 +21,8 @@ import ( "github.com/KusionStack/karbour/pkg/search/storage" ) +type ctxTyp string + const ( searchQueryKey = "query" patternTypeKey = "patternType" @@ -63,6 +65,5 @@ func FromQueryToContext(req *http.Request, key string, defaultVal string) *http. query.Del(key) val = queryVal[0] } - - return req.WithContext(context.WithValue(req.Context(), key, val)) + return req.WithContext(context.WithValue(req.Context(), ctxTyp(key), val)) }