From e8df07b0a46c805be8c5be343a74a644854262ea Mon Sep 17 00:00:00 2001 From: hfuss Date: Wed, 15 Jan 2025 15:13:53 -0500 Subject: [PATCH] fixed headers; ignore cyclo of newconfig; faster linting Signed-off-by: hfuss --- Makefile | 2 +- pkg/ffresty/ffresty.go | 7 +++---- pkg/ffresty/ffresty_test.go | 2 +- pkg/metric/metric_test.go | 2 +- pkg/metric/prometheusMetricsManager.go | 2 +- 5 files changed, 7 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index b95a4fb..dd69c70 100644 --- a/Makefile +++ b/Makefile @@ -17,7 +17,7 @@ coverage.html: $(VGO) tool cover -html=coverage.txt coverage: test coverage.html lint: ${LINT} - GOGC=20 $(LINT) run -v --timeout 5m + GOGC=20 $(LINT) run -v --timeout 5m --fast --allow-parallel-runners ${MOCKERY}: $(VGO) install github.com/vektra/mockery/v2@latest ${LINT}: diff --git a/pkg/ffresty/ffresty.go b/pkg/ffresty/ffresty.go index 0b4bb71..18ba0f2 100644 --- a/pkg/ffresty/ffresty.go +++ b/pkg/ffresty/ffresty.go @@ -1,4 +1,4 @@ -// Copyright © 2024 Kaleido, Inc. +// Copyright © 2025 Kaleido, Inc. // // SPDX-License-Identifier: Apache-2.0 // @@ -198,7 +198,7 @@ func GetRateLimiter(rps, burst int) *rate.Limiter { // // You can use the normal Resty builder pattern, to set per-instance configuration // as required. -func NewWithConfig(ctx context.Context, ffrestyConfig Config) (client *resty.Client) { +func NewWithConfig(ctx context.Context, ffrestyConfig Config) (client *resty.Client) { //nolint:gocyclo if ffrestyConfig.HTTPCustomClient != nil { if httpClient, ok := ffrestyConfig.HTTPCustomClient.(*http.Client); ok { client = resty.NewWithClient(httpClient) @@ -259,6 +259,7 @@ func NewWithConfig(ctx context.Context, ffrestyConfig Config) (client *resty.Cli } rCtx := req.Context() // Record host in context to avoid redundant parses in hooks + rCtx = context.WithValue(rCtx, hostCtxKey{}, "unknown") var u *url.URL if req.URL != "" { u, _ = url.Parse(req.URL) @@ -275,8 +276,6 @@ func NewWithConfig(ctx context.Context, ffrestyConfig Config) (client *resty.Cli if u != nil && u.Host != "" { host := u.Host rCtx = context.WithValue(rCtx, hostCtxKey{}, host) - } else { - rCtx = context.WithValue(rCtx, hostCtxKey{}, "unknown") } rc := rCtx.Value(retryCtxKey{}) if rc == nil { diff --git a/pkg/ffresty/ffresty_test.go b/pkg/ffresty/ffresty_test.go index 27d2182..7dc79c3 100644 --- a/pkg/ffresty/ffresty_test.go +++ b/pkg/ffresty/ffresty_test.go @@ -1,4 +1,4 @@ -// Copyright © 2024 Kaleido, Inc. +// Copyright © 2025 Kaleido, Inc. // // SPDX-License-Identifier: Apache-2.0 // diff --git a/pkg/metric/metric_test.go b/pkg/metric/metric_test.go index 8f2144c..85424f9 100644 --- a/pkg/metric/metric_test.go +++ b/pkg/metric/metric_test.go @@ -1,4 +1,4 @@ -// Copyright © 2023 Kaleido, Inc. +// Copyright © 2025 Kaleido, Inc. // // SPDX-License-Identifier: Apache-2.0 // diff --git a/pkg/metric/prometheusMetricsManager.go b/pkg/metric/prometheusMetricsManager.go index 196ccd1..fd01b5b 100644 --- a/pkg/metric/prometheusMetricsManager.go +++ b/pkg/metric/prometheusMetricsManager.go @@ -1,4 +1,4 @@ -// Copyright © 2024 Kaleido, Inc. +// Copyright © 2025 Kaleido, Inc. // // SPDX-License-Identifier: Apache-2.0 //