From 5bc77b7f785fa5a03b24bf0d1594faf91579d907 Mon Sep 17 00:00:00 2001 From: Haytham AbuelFutuh Date: Mon, 13 Apr 2020 15:24:21 -0700 Subject: [PATCH] lint --- storage/config.go | 2 +- storage/rawstores.go | 6 +++--- storage/rawstores_test.go | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/storage/config.go b/storage/config.go index 2bed6b2..c1c1b95 100644 --- a/storage/config.go +++ b/storage/config.go @@ -54,7 +54,7 @@ type Config struct { // If this section is skipped, Caching is disabled Cache CachingConfig `json:"cache"` Limits LimitsConfig `json:"limits" pflag:",Sets limits for stores."` - DefaultHttpClientHeaders map[string][]string `json:"defaultHttpClientHeaders" pflag:"-,Sets http headers to set on the default http client."` + DefaultHTTPClientHeaders map[string][]string `json:"defaultHttpClientHeaders" pflag:"-,Sets http headers to set on the default http client."` } // Defines connection configurations. diff --git a/storage/rawstores.go b/storage/rawstores.go index a605fdf..5f17457 100644 --- a/storage/rawstores.go +++ b/storage/rawstores.go @@ -39,7 +39,7 @@ func applyDefaultHeaders(r *http.Request, headers map[string][]string) { } } -func createHttpClientWithDefaultHeaders(headers map[string][]string) *http.Client { +func createHTTPClientWithDefaultHeaders(headers map[string][]string) *http.Client { c := &http.Client{} c.Transport = &proxyTransport{ RoundTripper: http.DefaultTransport, @@ -54,13 +54,13 @@ func NewDataStore(cfg *Config, metricsScope promutils.Scope) (s *DataStore, err // HACK: This sets http headers to the default http client. This is because // some underlying stores (e.g. S3 Stow Store) grabs the default http client // and doesn't allow configuration of default headers. - if len(cfg.DefaultHttpClientHeaders) > 0 { + if len(cfg.DefaultHTTPClientHeaders) > 0 { defaultClient := http.DefaultClient defer func() { http.DefaultClient = defaultClient }() - http.DefaultClient = createHttpClientWithDefaultHeaders(cfg.DefaultHttpClientHeaders) + http.DefaultClient = createHTTPClientWithDefaultHeaders(cfg.DefaultHTTPClientHeaders) } var rawStore RawStore diff --git a/storage/rawstores_test.go b/storage/rawstores_test.go index b21aa6e..5968098 100644 --- a/storage/rawstores_test.go +++ b/storage/rawstores_test.go @@ -9,7 +9,7 @@ import ( func Test_createHttpClientWithDefaultHeaders(t *testing.T) { t.Run("nil", func(t *testing.T) { - client := createHttpClientWithDefaultHeaders(nil) + client := createHTTPClientWithDefaultHeaders(nil) assert.NotNil(t, client.Transport) proxyTransport, casted := client.Transport.(*proxyTransport) assert.True(t, casted) @@ -20,7 +20,7 @@ func Test_createHttpClientWithDefaultHeaders(t *testing.T) { m := map[string][]string{ "Header1": {"val1", "val2"}, } - client := createHttpClientWithDefaultHeaders(m) + client := createHTTPClientWithDefaultHeaders(m) assert.NotNil(t, client.Transport) proxyTransport, casted := client.Transport.(*proxyTransport) assert.True(t, casted)