From 8d676681e1893c25e22fc71973cc49f7bc05e09b Mon Sep 17 00:00:00 2001 From: Bogdan Drutu Date: Thu, 19 Dec 2024 21:40:22 -0800 Subject: [PATCH] [chore] Upgrade golangci and fix lint issues Signed-off-by: Bogdan Drutu --- .../metricsdata_to_logservice.go | 7 -- .../awsemfexporter/metric_translator_test.go | 7 -- .../googlecloudpubsubexporter/watermark.go | 6 +- exporter/mezmoexporter/utils.go | 6 +- .../internal/apm/correlations/client.go | 6 +- .../internal/apm/tracetracker/cache.go | 4 +- .../internal/apm/tracetracker/tracker.go | 8 +- extension/observer/ecsobserver/fetcher.go | 13 +--- .../ecsobserver/internal/ecsmock/service.go | 11 +-- .../config_test.go | 30 ++++---- internal/aws/cwlogs/pusher_test.go | 14 ++-- internal/exp/metrics/staleness/staleness.go | 8 +- .../exp/metrics/staleness/staleness_test.go | 3 +- internal/tools/go.mod | 37 +++++---- internal/tools/go.sum | 76 +++++++++---------- .../operator/helper/severity_builder.go | 8 +- pkg/stanza/operator/parser/regex/cache.go | 4 +- .../operator/parser/regex/cache_test.go | 14 ++-- .../prometheusremotewrite/helper.go | 17 ++--- .../prometheusremotewrite/metrics_to_prw.go | 2 +- .../metrics_to_prw_v2.go | 2 +- pkg/translator/signalfx/from_metrics.go | 8 +- .../internal/data/expo/scale.go | 2 +- .../internal/data/expo/zero.go | 4 +- .../metrics_testcase_builder_test.go | 6 +- .../internal/metrics/func_scale_test.go | 6 +- .../internal/host/utils.go | 4 +- .../cwmetricstream/metricsbuilder.go | 12 +-- .../otlpmetricstream/unmarshaler_test.go | 12 +-- 29 files changed, 148 insertions(+), 189 deletions(-) diff --git a/exporter/alibabacloudlogserviceexporter/metricsdata_to_logservice.go b/exporter/alibabacloudlogserviceexporter/metricsdata_to_logservice.go index c01e83447400..d320eea7305b 100644 --- a/exporter/alibabacloudlogserviceexporter/metricsdata_to_logservice.go +++ b/exporter/alibabacloudlogserviceexporter/metricsdata_to_logservice.go @@ -139,13 +139,6 @@ func newMetricLogFromRaw( } } -func min(l, r int) int { - if l < r { - return l - } - return r -} - func resourceToMetricLabels(labels *KeyValues, resource pcommon.Resource) { attrs := resource.Attributes() attrs.Range(func(k string, v pcommon.Value) bool { diff --git a/exporter/awsemfexporter/metric_translator_test.go b/exporter/awsemfexporter/metric_translator_test.go index 3a8f9268624c..beaedb4d2ed7 100644 --- a/exporter/awsemfexporter/metric_translator_test.go +++ b/exporter/awsemfexporter/metric_translator_test.go @@ -120,13 +120,6 @@ func stringSlicesEqual(expected, actual []string) bool { return true } -func min(i, j int) int { - if i < j { - return i - } - return j -} - type dimensionality [][]string func (d dimensionality) Len() int { diff --git a/exporter/googlecloudpubsubexporter/watermark.go b/exporter/googlecloudpubsubexporter/watermark.go index 66997204832f..4eb4672e5860 100644 --- a/exporter/googlecloudpubsubexporter/watermark.go +++ b/exporter/googlecloudpubsubexporter/watermark.go @@ -35,9 +35,9 @@ type collector struct { func (c *collector) earliest(timestamp pcommon.Timestamp) bool { t := timestamp.AsTime() if t.Before(c.calculatedTime) { - min := c.processingTime.Add(-c.allowedDrift) - if t.Before(min) { - c.calculatedTime = min + minTime := c.processingTime.Add(-c.allowedDrift) + if t.Before(minTime) { + c.calculatedTime = minTime return true } c.calculatedTime = t diff --git a/exporter/mezmoexporter/utils.go b/exporter/mezmoexporter/utils.go index 3e56d9bca579..057396046dfd 100644 --- a/exporter/mezmoexporter/utils.go +++ b/exporter/mezmoexporter/utils.go @@ -4,10 +4,10 @@ package mezmoexporter // import "github.com/open-telemetry/opentelemetry-collector-contrib/exporter/mezmoexporter" // truncateString Truncates the given string to a maximum length provided by max. -func truncateString(s string, max int) string { - if len(s) < max { +func truncateString(s string, maxLen int) string { + if len(s) < maxLen { return s } - return s[:max] + return s[:maxLen] } diff --git a/exporter/signalfxexporter/internal/apm/correlations/client.go b/exporter/signalfxexporter/internal/apm/correlations/client.go index 95f418ee01ff..e9e592afe46a 100644 --- a/exporter/signalfxexporter/internal/apm/correlations/client.go +++ b/exporter/signalfxexporter/internal/apm/correlations/client.go @@ -191,10 +191,10 @@ func (cc *Client) Correlate(cor *Correlation, cb CorrelateCB) { cor.Logger(cc.log).WithFields(log.Fields{"method": http.MethodPut}).Info("Updated dimension") } case http.StatusTeapot: - max := &ErrMaxEntries{} - err = json.Unmarshal(body, max) + maxEntry := &ErrMaxEntries{} + err = json.Unmarshal(body, maxEntry) if err == nil { - err = max + err = maxEntry } } if err != nil { diff --git a/exporter/signalfxexporter/internal/apm/tracetracker/cache.go b/exporter/signalfxexporter/internal/apm/tracetracker/cache.go index aa618c9f1b7b..432f82bab431 100644 --- a/exporter/signalfxexporter/internal/apm/tracetracker/cache.go +++ b/exporter/signalfxexporter/internal/apm/tracetracker/cache.go @@ -52,10 +52,10 @@ func (t *TimeoutCache) IsFull() bool { return false } -func (t *TimeoutCache) SetMaxSize(max int64, now time.Time) { +func (t *TimeoutCache) SetMaxSize(maxSize int64, now time.Time) { t.Lock() defer t.Unlock() - t.maxSize = max + t.maxSize = maxSize t.maxSizeExpiryTS = now.Add(time.Hour * 1) } diff --git a/exporter/signalfxexporter/internal/apm/tracetracker/tracker.go b/exporter/signalfxexporter/internal/apm/tracetracker/tracker.go index 03adce7b9240..dc8434ed2b7e 100644 --- a/exporter/signalfxexporter/internal/apm/tracetracker/tracker.go +++ b/exporter/signalfxexporter/internal/apm/tracetracker/tracker.go @@ -167,8 +167,8 @@ func (a *ActiveServiceTracker) processEnvironment(res pcommon.Resource, now time a.hostEnvironmentCache.UpdateOrCreate(&CacheKey{value: environment}, now) } // nolint:errorlint - if max, ok := err.(*correlations.ErrMaxEntries); ok && max.MaxEntries > 0 { - a.hostEnvironmentCache.SetMaxSize(max.MaxEntries, now) + if maxEntry, ok := err.(*correlations.ErrMaxEntries); ok && maxEntry.MaxEntries > 0 { + a.hostEnvironmentCache.SetMaxSize(maxEntry.MaxEntries, now) } }) } @@ -226,8 +226,8 @@ func (a *ActiveServiceTracker) processService(res pcommon.Resource, now time.Tim a.hostServiceCache.UpdateOrCreate(&CacheKey{value: service}, now) } // nolint:errorlint - if max, ok := err.(*correlations.ErrMaxEntries); ok && max.MaxEntries > 0 { - a.hostServiceCache.SetMaxSize(max.MaxEntries, now) + if maxEntry, ok := err.(*correlations.ErrMaxEntries); ok && maxEntry.MaxEntries > 0 { + a.hostServiceCache.SetMaxSize(maxEntry.MaxEntries, now) } }) } diff --git a/extension/observer/ecsobserver/fetcher.go b/extension/observer/ecsobserver/fetcher.go index f69dcf5223fa..65acb85f0f19 100644 --- a/extension/observer/ecsobserver/fetcher.go +++ b/extension/observer/ecsobserver/fetcher.go @@ -260,7 +260,7 @@ func (f *taskFetcher) attachContainerInstance(ctx context.Context, tasks []*task // DescribeContainerInstance size limit is 100, do it in batch. for i := 0; i < len(instanceList); i += describeContainerInstanceLimit { - end := minInt(i+describeContainerInstanceLimit, len(instanceList)) + end := min(i+describeContainerInstanceLimit, len(instanceList)) if err := f.describeContainerInstances(ctx, instanceList[i:end], ciToEC2); err != nil { return fmt.Errorf("describe container instanced failed offset=%d: %w", i, err) } @@ -365,7 +365,7 @@ func (f *taskFetcher) getAllServices(ctx context.Context) ([]*ecs.Service, error // DescribeServices size limit is 10 so we need to do paging on client side. var services []*ecs.Service for i := 0; i < len(servicesToDescribe); i += describeServiceLimit { - end := minInt(i+describeServiceLimit, len(servicesToDescribe)) + end := min(i+describeServiceLimit, len(servicesToDescribe)) desc := &ecs.DescribeServicesInput{ Cluster: cluster, Services: servicesToDescribe[i:end], @@ -424,12 +424,3 @@ func sortStringPointers(ps []*string) { ps[i] = aws.String(ss[i]) } } - -func minInt(a, b int) int { - if a < b { - return a - } - return b -} - -// Util End diff --git a/extension/observer/ecsobserver/internal/ecsmock/service.go b/extension/observer/ecsobserver/internal/ecsmock/service.go index 77ac558cd5e3..2225ef7546da 100644 --- a/extension/observer/ecsobserver/internal/ecsmock/service.go +++ b/extension/observer/ecsobserver/internal/ecsmock/service.go @@ -437,7 +437,7 @@ func getPage(p pageInput) (*pageOutput, error) { return nil, fmt.Errorf("invalid next token %q: %w", token, err) } } - end := minInt(p.size, start+p.limit) + end := min(p.size, start+p.limit) var newNextToken *string if end < p.size { newNextToken = aws.String(strconv.Itoa(end)) @@ -462,12 +462,3 @@ func getArns(items any, arnGetter func(i int) *string) []*string { } return arns } - -// 'generic' End - -func minInt(a, b int) int { - if a < b { - return a - } - return b -} diff --git a/extension/solarwindsapmsettingsextension/config_test.go b/extension/solarwindsapmsettingsextension/config_test.go index d1ca784893f1..dfe8832012b6 100644 --- a/extension/solarwindsapmsettingsextension/config_test.go +++ b/extension/solarwindsapmsettingsextension/config_test.go @@ -4,7 +4,6 @@ package solarwindsapmsettingsextension import ( - "os" "path/filepath" "testing" "time" @@ -275,21 +274,26 @@ func TestLoadConfig(t *testing.T) { } } -func TestResolveServiceNameBestEffort(t *testing.T) { +func TestResolveServiceNameBestEffortNoEnv(t *testing.T) { // Without any environment variables require.Empty(t, resolveServiceNameBestEffort()) - // With OTEL_SERVICE_NAME only - require.NoError(t, os.Setenv("OTEL_SERVICE_NAME", "otel_ser1")) +} + +// With OTEL_SERVICE_NAME only +func TestResolveServiceNameBestEffortOnlyOtelService(t *testing.T) { + t.Setenv("OTEL_SERVICE_NAME", "otel_ser1") require.Equal(t, "otel_ser1", resolveServiceNameBestEffort()) - require.NoError(t, os.Unsetenv("OTEL_SERVICE_NAME")) - // With AWS_LAMBDA_FUNCTION_NAME only - require.NoError(t, os.Setenv("AWS_LAMBDA_FUNCTION_NAME", "lambda")) +} + +// With AWS_LAMBDA_FUNCTION_NAME only +func TestResolveServiceNameBestEffortOnlyAwsLambda(t *testing.T) { + t.Setenv("AWS_LAMBDA_FUNCTION_NAME", "lambda") require.Equal(t, "lambda", resolveServiceNameBestEffort()) - require.NoError(t, os.Unsetenv("AWS_LAMBDA_FUNCTION_NAME")) - // With both - require.NoError(t, os.Setenv("OTEL_SERVICE_NAME", "otel_ser1")) - require.NoError(t, os.Setenv("AWS_LAMBDA_FUNCTION_NAME", "lambda")) +} + +// With both +func TestResolveServiceNameBestEffortBoth(t *testing.T) { + t.Setenv("OTEL_SERVICE_NAME", "otel_ser1") + t.Setenv("AWS_LAMBDA_FUNCTION_NAME", "lambda") require.Equal(t, "otel_ser1", resolveServiceNameBestEffort()) - require.NoError(t, os.Unsetenv("AWS_LAMBDA_FUNCTION_NAME")) - require.NoError(t, os.Unsetenv("OTEL_SERVICE_NAME")) } diff --git a/internal/aws/cwlogs/pusher_test.go b/internal/aws/cwlogs/pusher_test.go index acd79d697a7c..b4d217f856b3 100644 --- a/internal/aws/cwlogs/pusher_test.go +++ b/internal/aws/cwlogs/pusher_test.go @@ -54,29 +54,29 @@ func TestValidateLogEventFailed(t *testing.T) { // eventBatch Tests func TestLogEventBatch_timestampWithin24Hours(t *testing.T) { - min := time.Date(2017, time.June, 20, 23, 38, 0, 0, time.Local) - max := min.Add(23 * time.Hour) + minDate := time.Date(2017, time.June, 20, 23, 38, 0, 0, time.Local) + maxDate := minDate.Add(23 * time.Hour) logEventBatch := &eventBatch{ - maxTimestampMs: max.UnixNano() / 1e6, - minTimestampMs: min.UnixNano() / 1e6, + maxTimestampMs: maxDate.UnixNano() / 1e6, + minTimestampMs: minDate.UnixNano() / 1e6, } // less than the min - target := min.Add(-1 * time.Hour) + target := minDate.Add(-1 * time.Hour) assert.True(t, logEventBatch.isActive(aws.Int64(target.UnixNano()/1e6))) target = target.Add(-1 * time.Millisecond) assert.False(t, logEventBatch.isActive(aws.Int64(target.UnixNano()/1e6))) // more than the max - target = max.Add(1 * time.Hour) + target = maxDate.Add(1 * time.Hour) assert.True(t, logEventBatch.isActive(aws.Int64(target.UnixNano()/1e6))) target = target.Add(1 * time.Millisecond) assert.False(t, logEventBatch.isActive(aws.Int64(target.UnixNano()/1e6))) // in between min and max - target = min.Add(2 * time.Hour) + target = minDate.Add(2 * time.Hour) assert.True(t, logEventBatch.isActive(aws.Int64(target.UnixNano()/1e6))) } diff --git a/internal/exp/metrics/staleness/staleness.go b/internal/exp/metrics/staleness/staleness.go index eb52e6861825..895174422878 100644 --- a/internal/exp/metrics/staleness/staleness.go +++ b/internal/exp/metrics/staleness/staleness.go @@ -31,9 +31,9 @@ type Staleness[T any] struct { pq PriorityQueue } -func NewStaleness[T any](max time.Duration, items streams.Map[T]) *Staleness[T] { +func NewStaleness[T any](maxDuration time.Duration, items streams.Map[T]) *Staleness[T] { return &Staleness[T]{ - Max: max, + Max: maxDuration, items: items, pq: NewPriorityQueue(), @@ -117,13 +117,13 @@ func (stale Tracker) Refresh(ts time.Time, ids ...identity.Stream) { } } -func (stale Tracker) Collect(max time.Duration) []identity.Stream { +func (stale Tracker) Collect(maxDuration time.Duration) []identity.Stream { now := NowFunc() var ids []identity.Stream for stale.pq.Len() > 0 { _, ts := stale.pq.Peek() - if now.Sub(ts) < max { + if now.Sub(ts) < maxDuration { break } id, _ := stale.pq.Pop() diff --git a/internal/exp/metrics/staleness/staleness_test.go b/internal/exp/metrics/staleness/staleness_test.go index 9d0b2a4ada30..24de1853c99f 100644 --- a/internal/exp/metrics/staleness/staleness_test.go +++ b/internal/exp/metrics/staleness/staleness_test.go @@ -14,9 +14,8 @@ import ( ) func TestStaleness(t *testing.T) { - max := 1 * time.Second stalenessMap := NewStaleness[int]( - max, + 1*time.Second, make(streams.HashMap[int]), ) diff --git a/internal/tools/go.mod b/internal/tools/go.mod index e0dc1f42dc37..1b345095a40d 100644 --- a/internal/tools/go.mod +++ b/internal/tools/go.mod @@ -7,7 +7,7 @@ require ( github.com/Khan/genqlient v0.7.0 github.com/client9/misspell v0.3.4 github.com/daixiang0/gci v0.13.5 - github.com/golangci/golangci-lint v1.59.1 + github.com/golangci/golangci-lint v1.60.1 github.com/google/addlicense v1.1.1 github.com/jcchavezs/porto v0.6.0 github.com/jstemmer/go-junit-report v1.0.0 @@ -19,7 +19,7 @@ require ( go.opentelemetry.io/collector/cmd/builder v0.116.0 go.opentelemetry.io/collector/cmd/mdatagen v0.116.0 go.uber.org/goleak v1.3.0 - golang.org/x/tools v0.27.0 + golang.org/x/tools v0.28.0 golang.org/x/vuln v1.1.3 gotest.tools/gotestsum v1.12.0 mvdan.cc/gofumpt v0.6.0 @@ -33,10 +33,10 @@ require ( github.com/Abirdcfly/dupword v0.0.14 // indirect github.com/Antonboom/errname v0.1.13 // indirect github.com/Antonboom/nilnil v0.1.9 // indirect - github.com/BurntSushi/toml v1.4.0 // indirect - github.com/Crocmagnon/fatcontext v0.2.2 // indirect + github.com/BurntSushi/toml v1.4.1-0.20240526193622-a339e1f7089c // indirect + github.com/Crocmagnon/fatcontext v0.4.0 // indirect github.com/Djarvur/go-err113 v0.0.0-20210108212216-aea10b59be24 // indirect - github.com/GaijinEntertainment/go-exhaustruct/v3 v3.2.0 // indirect + github.com/GaijinEntertainment/go-exhaustruct/v3 v3.3.0 // indirect github.com/Masterminds/semver/v3 v3.2.1 // indirect github.com/Microsoft/go-winio v0.6.1 // indirect github.com/OpenPeeDeeP/depguard/v2 v2.2.0 // indirect @@ -55,7 +55,7 @@ require ( github.com/bkielbasa/cyclop v1.2.1 // indirect github.com/blizzy78/varnamelen v0.8.0 // indirect github.com/bmatcuk/doublestar/v4 v4.0.2 // indirect - github.com/bombsimon/wsl/v4 v4.2.1 // indirect + github.com/bombsimon/wsl/v4 v4.4.1 // indirect github.com/breml/bidichk v0.2.7 // indirect github.com/breml/errchkjson v0.3.6 // indirect github.com/butuzov/ireturn v0.3.0 // indirect @@ -94,7 +94,7 @@ require ( github.com/go-viper/mapstructure/v2 v2.2.1 // indirect github.com/go-xmlfmt/xmlfmt v1.1.2 // indirect github.com/gobwas/glob v0.2.3 // indirect - github.com/gofrs/flock v0.8.1 // indirect + github.com/gofrs/flock v0.12.1 // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect github.com/golangci/dupl v0.0.0-20180902072040-3e9179ac440a // indirect @@ -121,7 +121,7 @@ require ( github.com/jgautheron/goconst v1.7.1 // indirect github.com/jingyugao/rowserrcheck v1.1.1 // indirect github.com/jirfag/go-printf-func-name v0.0.0-20200119135958-7558a9eaa5af // indirect - github.com/jjti/go-spancheck v0.6.1 // indirect + github.com/jjti/go-spancheck v0.6.2 // indirect github.com/joshdk/go-junit v1.0.0 // indirect github.com/json-iterator/go v1.1.12 // indirect github.com/julz/importas v0.1.0 // indirect @@ -152,14 +152,14 @@ require ( github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.20 // indirect github.com/mattn/go-runewidth v0.0.9 // indirect - github.com/mgechev/revive v1.3.7 // indirect + github.com/mgechev/revive v1.3.9 // indirect github.com/mitchellh/copystructure v1.2.0 // indirect github.com/mitchellh/go-homedir v1.1.0 // indirect github.com/mitchellh/mapstructure v1.5.1-0.20220423185008-bf980b35cac4 // indirect github.com/mitchellh/reflectwalk v1.0.2 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect - github.com/moricho/tparallel v0.3.1 // indirect + github.com/moricho/tparallel v0.3.2 // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/nakabonne/nestif v0.3.1 // indirect github.com/nishanths/exhaustive v0.12.0 // indirect @@ -169,7 +169,7 @@ require ( github.com/pelletier/go-toml/v2 v2.2.2 // indirect github.com/pjbgf/sha1cd v0.3.0 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect - github.com/polyfloyd/go-errorlint v1.5.2 // indirect + github.com/polyfloyd/go-errorlint v1.6.0 // indirect github.com/prometheus/client_golang v1.20.3 // indirect github.com/prometheus/client_model v0.6.1 // indirect github.com/prometheus/common v0.59.1 // indirect @@ -179,20 +179,20 @@ require ( github.com/quasilyte/gogrep v0.5.0 // indirect github.com/quasilyte/regex/syntax v0.0.0-20210819130434-b3f0c404a727 // indirect github.com/quasilyte/stdinfo v0.0.0-20220114132959-f7386bf02567 // indirect - github.com/ryancurrah/gomodguard v1.3.2 // indirect + github.com/ryancurrah/gomodguard v1.3.3 // indirect github.com/ryanrolds/sqlclosecheck v0.5.1 // indirect github.com/sagikazarmark/locafero v0.4.0 // indirect github.com/sagikazarmark/slog-shim v0.1.0 // indirect github.com/sanposhiho/wastedassign/v2 v2.0.7 // indirect github.com/santhosh-tekuri/jsonschema/v5 v5.3.1 // indirect github.com/sashamelentyev/interfacebloat v1.1.0 // indirect - github.com/sashamelentyev/usestdlibvars v1.26.0 // indirect + github.com/sashamelentyev/usestdlibvars v1.27.0 // indirect github.com/securego/gosec/v2 v2.20.1-0.20240525090044-5f0084eb01a9 // indirect github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3 // indirect github.com/shazow/go-diff v0.0.0-20160112020656-b6b7b6733b8c // indirect github.com/sirupsen/logrus v1.9.3 // indirect github.com/sivchari/containedctx v1.0.3 // indirect - github.com/sivchari/tenv v1.7.1 // indirect + github.com/sivchari/tenv v1.10.0 // indirect github.com/skeema/knownhosts v1.2.2 // indirect github.com/sonatard/noctx v0.0.2 // indirect github.com/sourcegraph/conc v0.3.0 // indirect @@ -207,7 +207,6 @@ require ( github.com/stretchr/objx v0.5.2 // indirect github.com/stretchr/testify v1.10.0 // indirect github.com/subosito/gotenv v1.6.0 // indirect - github.com/t-yuki/gocover-cobertura v0.0.0-20180217150009-aaee18c8195c // indirect github.com/tdakkota/asciicheck v0.2.0 // indirect github.com/tetafro/godot v1.4.16 // indirect github.com/timakin/bodyclose v0.0.0-20230421092635-574207250966 // indirect @@ -216,7 +215,7 @@ require ( github.com/tommy-muehle/go-mnd/v2 v2.5.1 // indirect github.com/ultraware/funlen v0.1.0 // indirect github.com/ultraware/whitespace v0.1.1 // indirect - github.com/uudashr/gocognit v1.1.2 // indirect + github.com/uudashr/gocognit v1.1.3 // indirect github.com/vektah/gqlparser/v2 v2.5.16 // indirect github.com/xanzy/ssh-agent v0.3.3 // indirect github.com/xen0n/gosmopolitan v1.2.2 // indirect @@ -225,7 +224,7 @@ require ( github.com/ykadowak/zerologlint v0.1.5 // indirect gitlab.com/bosi/decorder v0.4.2 // indirect go-simpler.org/musttag v0.12.2 // indirect - go-simpler.org/sloglint v0.7.1 // indirect + go-simpler.org/sloglint v0.7.2 // indirect go.opentelemetry.io/build-tools v0.15.0 // indirect go.opentelemetry.io/collector/component v0.116.0 // indirect go.opentelemetry.io/collector/config/configtelemetry v0.116.0 // indirect @@ -243,7 +242,7 @@ require ( golang.org/x/exp v0.0.0-20240103183307-be819d1f06fc // indirect golang.org/x/exp/typeparams v0.0.0-20240314144324-c7f7c6466f7f // indirect golang.org/x/mod v0.22.0 // indirect - golang.org/x/net v0.31.0 // indirect + golang.org/x/net v0.32.0 // indirect golang.org/x/oauth2 v0.23.0 // indirect golang.org/x/sync v0.10.0 // indirect golang.org/x/sys v0.28.0 // indirect @@ -257,7 +256,7 @@ require ( gopkg.in/warnings.v0 v0.1.2 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect - honnef.co/go/tools v0.4.7 // indirect + honnef.co/go/tools v0.5.0 // indirect mvdan.cc/unparam v0.0.0-20240528143540-8a5130ca722f // indirect ) diff --git a/internal/tools/go.sum b/internal/tools/go.sum index f70e7a61c262..ee91bb9f264b 100644 --- a/internal/tools/go.sum +++ b/internal/tools/go.sum @@ -14,14 +14,14 @@ github.com/Antonboom/nilnil v0.1.9 h1:eKFMejSxPSA9eLSensFmjW2XTgTwJMjZ8hUHtV4s/S github.com/Antonboom/nilnil v0.1.9/go.mod h1:iGe2rYwCq5/Me1khrysB4nwI7swQvjclR8/YRPl5ihQ= github.com/Antonboom/testifylint v1.5.2 h1:4s3Xhuv5AvdIgbd8wOOEeo0uZG7PbDKQyKY5lGoQazk= github.com/Antonboom/testifylint v1.5.2/go.mod h1:vxy8VJ0bc6NavlYqjZfmp6EfqXMtBgQ4+mhCojwC1P8= -github.com/BurntSushi/toml v1.4.0 h1:kuoIxZQy2WRRk1pttg9asf+WVv6tWQuBNVmK8+nqPr0= -github.com/BurntSushi/toml v1.4.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho= -github.com/Crocmagnon/fatcontext v0.2.2 h1:OrFlsDdOj9hW/oBEJBNSuH7QWf+E9WPVHw+x52bXVbk= -github.com/Crocmagnon/fatcontext v0.2.2/go.mod h1:WSn/c/+MMNiD8Pri0ahRj0o9jVpeowzavOQplBJw6u0= +github.com/BurntSushi/toml v1.4.1-0.20240526193622-a339e1f7089c h1:pxW6RcqyfI9/kWtOwnv/G+AzdKuy2ZrqINhenH4HyNs= +github.com/BurntSushi/toml v1.4.1-0.20240526193622-a339e1f7089c/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho= +github.com/Crocmagnon/fatcontext v0.4.0 h1:4ykozu23YHA0JB6+thiuEv7iT6xq995qS1vcuWZq0tg= +github.com/Crocmagnon/fatcontext v0.4.0/go.mod h1:ZtWrXkgyfsYPzS6K3O88va6t2GEglG93vnII/F94WC0= github.com/Djarvur/go-err113 v0.0.0-20210108212216-aea10b59be24 h1:sHglBQTwgx+rWPdisA5ynNEsoARbiCBOyGcJM4/OzsM= github.com/Djarvur/go-err113 v0.0.0-20210108212216-aea10b59be24/go.mod h1:4UJr5HIiMZrwgkSPdsjy2uOQExX/WEILpIrO9UPGuXs= -github.com/GaijinEntertainment/go-exhaustruct/v3 v3.2.0 h1:sATXp1x6/axKxz2Gjxv8MALP0bXaNRfQinEwyfMcx8c= -github.com/GaijinEntertainment/go-exhaustruct/v3 v3.2.0/go.mod h1:Nl76DrGNJTA1KJ0LePKBw/vznBX1EHbAZX8mwjR82nI= +github.com/GaijinEntertainment/go-exhaustruct/v3 v3.3.0 h1:/fTUt5vmbkAcMBt4YQiuC23cV0kEsN1MVMNqeOW43cU= +github.com/GaijinEntertainment/go-exhaustruct/v3 v3.3.0/go.mod h1:ONJg5sxcbsdQQ4pOW8TGdTidT2TMAUy/2Xhr8mrYaao= github.com/Khan/genqlient v0.7.0 h1:GZ1meyRnzcDTK48EjqB8t3bcfYvHArCUUvgOwpz1D4w= github.com/Khan/genqlient v0.7.0/go.mod h1:HNyy3wZvuYwmW3Y7mkoQLZsa/R5n5yIRajS1kPBvSFM= github.com/Masterminds/semver/v3 v3.2.1 h1:RN9w6+7QoMeJVGyfmbcgs28Br8cvmnucEXnY0rYXWg0= @@ -73,8 +73,8 @@ github.com/blizzy78/varnamelen v0.8.0 h1:oqSblyuQvFsW1hbBHh1zfwrKe3kcSj0rnXkKzsQ github.com/blizzy78/varnamelen v0.8.0/go.mod h1:V9TzQZ4fLJ1DSrjVDfl89H7aMnTvKkApdHeyESmyR7k= github.com/bmatcuk/doublestar/v4 v4.0.2 h1:X0krlUVAVmtr2cRoTqR8aDMrDqnB36ht8wpWTiQ3jsA= github.com/bmatcuk/doublestar/v4 v4.0.2/go.mod h1:xBQ8jztBU6kakFMg+8WGxn0c6z1fTSPVIjEY1Wr7jzc= -github.com/bombsimon/wsl/v4 v4.2.1 h1:Cxg6u+XDWff75SIFFmNsqnIOgob+Q9hG6y/ioKbRFiM= -github.com/bombsimon/wsl/v4 v4.2.1/go.mod h1:Xu/kDxGZTofQcDGCtQe9KCzhHphIe0fDuyWTxER9Feo= +github.com/bombsimon/wsl/v4 v4.4.1 h1:jfUaCkN+aUpobrMO24zwyAMwMAV5eSziCkOKEauOLdw= +github.com/bombsimon/wsl/v4 v4.4.1/go.mod h1:Xu/kDxGZTofQcDGCtQe9KCzhHphIe0fDuyWTxER9Feo= github.com/bradleyjkemp/cupaloy/v2 v2.6.0 h1:knToPYa2xtfg42U3I6punFEjaGFKWQRXJwj0JTv4mTs= github.com/bradleyjkemp/cupaloy/v2 v2.6.0/go.mod h1:bm7JXdkRd4BHJk9HpwqAI8BoAY1lps46Enkdqw6aRX0= github.com/breml/bidichk v0.2.7 h1:dAkKQPLl/Qrk7hnP6P+E0xOodrq8Us7+U0o4UBOAlQY= @@ -185,8 +185,8 @@ github.com/go-xmlfmt/xmlfmt v1.1.2 h1:Nea7b4icn8s57fTx1M5AI4qQT5HEM3rVUO8MuE6g80 github.com/go-xmlfmt/xmlfmt v1.1.2/go.mod h1:aUCEOzzezBEjDBbFBoSiya/gduyIiWYRP6CnSFIV8AM= github.com/gobwas/glob v0.2.3 h1:A4xDbljILXROh+kObIiy5kIaPYD8e96x1tgBhUI5J+Y= github.com/gobwas/glob v0.2.3/go.mod h1:d3Ez4x06l9bZtSvzIay5+Yzi0fmZzPgnTbPcKjJAkT8= -github.com/gofrs/flock v0.8.1 h1:+gYjHKf32LDeiEEFhQaotPbLuUXjY5ZqxKgXy7n59aw= -github.com/gofrs/flock v0.8.1/go.mod h1:F1TvTiK9OcQqauNUHlbJvyl9Qa1QvF/gOUDKA14jxHU= +github.com/gofrs/flock v0.12.1 h1:MTLVXXHf8ekldpJk3AKicLij9MdwOWkZ+a/jHHZby9E= +github.com/gofrs/flock v0.12.1/go.mod h1:9zxTsyu5xtJ9DK+1tFZyibEV7y3uwDxPPfbxeeHCoD0= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE= @@ -197,8 +197,8 @@ github.com/golangci/dupl v0.0.0-20180902072040-3e9179ac440a h1:w8hkcTqaFpzKqonE9 github.com/golangci/dupl v0.0.0-20180902072040-3e9179ac440a/go.mod h1:ryS0uhF+x9jgbj/N71xsEqODy9BN81/GonCZiOzirOk= github.com/golangci/gofmt v0.0.0-20231018234816-f50ced29576e h1:ULcKCDV1LOZPFxGZaA6TlQbiM3J2GCPnkx/bGF6sX/g= github.com/golangci/gofmt v0.0.0-20231018234816-f50ced29576e/go.mod h1:Pm5KhLPA8gSnQwrQ6ukebRcapGb/BG9iUkdaiCcGHJM= -github.com/golangci/golangci-lint v1.59.1 h1:CRRLu1JbhK5avLABFJ/OHVSQ0Ie5c4ulsOId1h3TTks= -github.com/golangci/golangci-lint v1.59.1/go.mod h1:jX5Oif4C7P0j9++YB2MMJmoNrb01NJ8ITqKWNLewThg= +github.com/golangci/golangci-lint v1.60.1 h1:DRKNqNTQRLBJZ1il5u4fvgLQCjQc7QFs0DbhksJtVJE= +github.com/golangci/golangci-lint v1.60.1/go.mod h1:jDIPN1rYaIA+ijp9OZcUmUCoQOtZ76pOlFbi15FlLJY= github.com/golangci/misspell v0.6.0 h1:JCle2HUTNWirNlDIAUO44hUsKhOFqGPoC4LZxlaSXDs= github.com/golangci/misspell v0.6.0/go.mod h1:keMNyY6R9isGaSAu+4Q8NMBwMPkh15Gtc8UCVoDtAWo= github.com/golangci/modinfo v0.3.4 h1:oU5huX3fbxqQXdfspamej74DFX0kyGLkw1ppvXoJ8GA= @@ -267,8 +267,8 @@ github.com/jingyugao/rowserrcheck v1.1.1 h1:zibz55j/MJtLsjP1OF4bSdgXxwL1b+Vn7Tjz github.com/jingyugao/rowserrcheck v1.1.1/go.mod h1:4yvlZSDb3IyDTUZJUmpZfm2Hwok+Dtp+nu2qOq+er9c= github.com/jirfag/go-printf-func-name v0.0.0-20200119135958-7558a9eaa5af h1:KA9BjwUk7KlCh6S9EAGWBt1oExIUv9WyNCiRz5amv48= github.com/jirfag/go-printf-func-name v0.0.0-20200119135958-7558a9eaa5af/go.mod h1:HEWGJkRDzjJY2sqdDwxccsGicWEf9BQOZsq2tV+xzM0= -github.com/jjti/go-spancheck v0.6.1 h1:ZK/wE5Kyi1VX3PJpUO2oEgeoI4FWOUm7Shb2Gbv5obI= -github.com/jjti/go-spancheck v0.6.1/go.mod h1:vF1QkOO159prdo6mHRxak2CpzDpHAfKiPUDP/NeRnX8= +github.com/jjti/go-spancheck v0.6.2 h1:iYtoxqPMzHUPp7St+5yA8+cONdyXD3ug6KK15n7Pklk= +github.com/jjti/go-spancheck v0.6.2/go.mod h1:+X7lvIrR5ZdUTkxFYqzJ0abr8Sb5LOo80uOhWNqIrYA= github.com/joshdk/go-junit v1.0.0 h1:S86cUKIdwBHWwA6xCmFlf3RTLfVXYQfvanM5Uh+K6GE= github.com/joshdk/go-junit v1.0.0/go.mod h1:TiiV0PqkaNfFXjEiyjWM3XXrhVyCa1K4Zfga6W52ung= github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= @@ -347,8 +347,8 @@ github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWE github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-runewidth v0.0.9 h1:Lm995f3rfxdpd6TSmuVCHVb/QhupuXlYr8sCI/QdE+0= github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= -github.com/mgechev/revive v1.3.7 h1:502QY0vQGe9KtYJ9FpxMz9rL+Fc/P13CI5POL4uHCcE= -github.com/mgechev/revive v1.3.7/go.mod h1:RJ16jUbF0OWC3co/+XTxmFNgEpUPwnnA0BRllX2aDNA= +github.com/mgechev/revive v1.3.9 h1:18Y3R4a2USSBF+QZKFQwVkBROUda7uoBlkEuBD+YD1A= +github.com/mgechev/revive v1.3.9/go.mod h1:+uxEIr5UH0TjXWHTno3xh4u7eg6jDpXKzQccA9UGhHU= github.com/mitchellh/copystructure v1.2.0 h1:vpKXTN4ewci03Vljg/q9QvCGUDttBOGBIa15WveJJGw= github.com/mitchellh/copystructure v1.2.0/go.mod h1:qLl+cE2AmVv+CoeAwDPye/v+N2HKCj9FbZEVFJRxO9s= github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= @@ -362,8 +362,8 @@ github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= -github.com/moricho/tparallel v0.3.1 h1:fQKD4U1wRMAYNngDonW5XupoB/ZGJHdpzrWqgyg9krA= -github.com/moricho/tparallel v0.3.1/go.mod h1:leENX2cUv7Sv2qDgdi0D0fCftN8fRC67Bcn8pqzeYNI= +github.com/moricho/tparallel v0.3.2 h1:odr8aZVFA3NZrNybggMkYO3rgPRcqjeQUlBBFVxKHTI= +github.com/moricho/tparallel v0.3.2/go.mod h1:OQ+K3b4Ln3l2TZveGCywybl68glfLEwFGqvnjok8b+U= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= github.com/nakabonne/nestif v0.3.1 h1:wm28nZjhQY5HyYPx+weN3Q65k6ilSBxDb8v5S81B81U= @@ -396,8 +396,8 @@ github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/polyfloyd/go-errorlint v1.5.2 h1:SJhVik3Umsjh7mte1vE0fVZ5T1gznasQG3PV7U5xFdA= -github.com/polyfloyd/go-errorlint v1.5.2/go.mod h1:sH1QC1pxxi0fFecsVIzBmxtrgd9IF/SkJpA6wqyKAJs= +github.com/polyfloyd/go-errorlint v1.6.0 h1:tftWV9DE7txiFzPpztTAwyoRLKNj9gpVm2cg8/OwcYY= +github.com/polyfloyd/go-errorlint v1.6.0/go.mod h1:HR7u8wuP1kb1NeN1zqTd1ZMlqUKPPHF+Id4vIPvDqVw= github.com/prashantv/gostub v1.1.0 h1:BTyx3RfQjRHnUWaGF9oQos79AlQ5k8WNktv7VGvVH4g= github.com/prashantv/gostub v1.1.0/go.mod h1:A5zLQHz7ieHGG7is6LLXLz7I8+3LZzsrV0P1IAHhP5U= github.com/prometheus/client_golang v1.20.3 h1:oPksm4K8B+Vt35tUhw6GbSNSgVlVSBH0qELP/7u83l4= @@ -422,8 +422,8 @@ github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUz github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/ryancurrah/gomodguard v1.3.2 h1:CuG27ulzEB1Gu5Dk5gP8PFxSOZ3ptSdP5iI/3IXxM18= -github.com/ryancurrah/gomodguard v1.3.2/go.mod h1:LqdemiFomEjcxOqirbQCb3JFvSxH2JUYMerTFd3sF2o= +github.com/ryancurrah/gomodguard v1.3.3 h1:eiSQdJVNr9KTNxY2Niij8UReSwR8Xrte3exBrAZfqpg= +github.com/ryancurrah/gomodguard v1.3.3/go.mod h1:rsKQjj4l3LXe8N344Ow7agAy5p9yjsWOtRzUMYmA0QY= github.com/ryanrolds/sqlclosecheck v0.5.1 h1:dibWW826u0P8jNLsLN+En7+RqWWTYrjCB9fJfSfdyCU= github.com/ryanrolds/sqlclosecheck v0.5.1/go.mod h1:2g3dUjoS6AL4huFdv6wn55WpLIDjY7ZgUR4J8HOO/XQ= github.com/sagikazarmark/locafero v0.4.0 h1:HApY1R9zGo4DBgr7dqsTH/JJxLTTsOt7u6keLGt6kNQ= @@ -436,8 +436,8 @@ github.com/santhosh-tekuri/jsonschema/v5 v5.3.1 h1:lZUw3E0/J3roVtGQ+SCrUrg3ON6Ng github.com/santhosh-tekuri/jsonschema/v5 v5.3.1/go.mod h1:uToXkOrWAZ6/Oc07xWQrPOhJotwFIyu2bBVN41fcDUY= github.com/sashamelentyev/interfacebloat v1.1.0 h1:xdRdJp0irL086OyW1H/RTZTr1h/tMEOsumirXcOJqAw= github.com/sashamelentyev/interfacebloat v1.1.0/go.mod h1:+Y9yU5YdTkrNvoX0xHc84dxiN1iBi9+G8zZIhPVoNjQ= -github.com/sashamelentyev/usestdlibvars v1.26.0 h1:LONR2hNVKxRmzIrZR0PhSF3mhCAzvnr+DcUiHgREfXE= -github.com/sashamelentyev/usestdlibvars v1.26.0/go.mod h1:9nl0jgOfHKWNFS43Ojw0i7aRoS4j6EBye3YBhmAIRF8= +github.com/sashamelentyev/usestdlibvars v1.27.0 h1:t/3jZpSXtRPRf2xr0m63i32ZrusyurIGT9E5wAvXQnI= +github.com/sashamelentyev/usestdlibvars v1.27.0/go.mod h1:9nl0jgOfHKWNFS43Ojw0i7aRoS4j6EBye3YBhmAIRF8= github.com/securego/gosec/v2 v2.20.1-0.20240525090044-5f0084eb01a9 h1:rnO6Zp1YMQwv8AyxzuwsVohljJgp4L0ZqiCgtACsPsc= github.com/securego/gosec/v2 v2.20.1-0.20240525090044-5f0084eb01a9/go.mod h1:dg7lPlu/xK/Ut9SedURCoZbVCR4yC7fM65DtH9/CDHs= github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3 h1:n661drycOFuPLCN3Uc8sB6B/s6Z4t2xvBgU1htSHuq8= @@ -451,8 +451,8 @@ github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= github.com/sivchari/containedctx v1.0.3 h1:x+etemjbsh2fB5ewm5FeLNi5bUjK0V8n0RB+Wwfd0XE= github.com/sivchari/containedctx v1.0.3/go.mod h1:c1RDvCbnJLtH4lLcYD/GqwiBSSf4F5Qk0xld2rBqzJ4= -github.com/sivchari/tenv v1.7.1 h1:PSpuD4bu6fSmtWMxSGWcvqUUgIn7k3yOJhOIzVWn8Ak= -github.com/sivchari/tenv v1.7.1/go.mod h1:64yStXKSOxDfX47NlhVwND4dHwfZDdbp2Lyl018Icvg= +github.com/sivchari/tenv v1.10.0 h1:g/hzMA+dBCKqGXgW8AV/1xIWhAvDrx0zFKNR48NFMg0= +github.com/sivchari/tenv v1.10.0/go.mod h1:tdY24masnVoZFxYrHv/nD6Tc8FbkEtAQEEziXpyMgqY= github.com/skeema/knownhosts v1.2.2 h1:Iug2P4fLmDw9f41PB6thxUkNUkJzB5i+1/exaj40L3A= github.com/skeema/knownhosts v1.2.2/go.mod h1:xYbVRSPxqBZFrdmDyMmsOs+uX1UZC3nTN3ThzgDxUwo= github.com/sonatard/noctx v0.0.2 h1:L7Dz4De2zDQhW8S0t+KUjY0MAQJd6SgVwhzNIc4ok00= @@ -494,8 +494,6 @@ github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOf github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8= github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU= -github.com/t-yuki/gocover-cobertura v0.0.0-20180217150009-aaee18c8195c h1:+aPplBwWcHBo6q9xrfWdMrT9o4kltkmmvpemgIjep/8= -github.com/t-yuki/gocover-cobertura v0.0.0-20180217150009-aaee18c8195c/go.mod h1:SbErYREK7xXdsRiigaQiQkI9McGRzYMvlKYaP3Nimdk= github.com/tdakkota/asciicheck v0.2.0 h1:o8jvnUANo0qXtnslk2d3nMKTFNlOnJjRrNcj0j9qkHM= github.com/tdakkota/asciicheck v0.2.0/go.mod h1:Qb7Y9EgjCLJGup51gDHFzbI08/gbGhL/UVhYIPWG2rg= github.com/tenntenn/modver v1.0.1 h1:2klLppGhDgzJrScMpkj9Ujy3rXPUspSjAcev9tSEBgA= @@ -516,8 +514,8 @@ github.com/ultraware/funlen v0.1.0 h1:BuqclbkY6pO+cvxoq7OsktIXZpgBSkYTQtmwhAK81v github.com/ultraware/funlen v0.1.0/go.mod h1:XJqmOQja6DpxarLj6Jj1U7JuoS8PvL4nEqDaQhy22p4= github.com/ultraware/whitespace v0.1.1 h1:bTPOGejYFulW3PkcrqkeQwOd6NKOOXvmGD9bo/Gk8VQ= github.com/ultraware/whitespace v0.1.1/go.mod h1:XcP1RLD81eV4BW8UhQlpaR+SDc2givTvyI8a586WjW8= -github.com/uudashr/gocognit v1.1.2 h1:l6BAEKJqQH2UpKAPKdMfZf5kE4W/2xk8pfU1OVLvniI= -github.com/uudashr/gocognit v1.1.2/go.mod h1:aAVdLURqcanke8h3vg35BC++eseDm66Z7KmchI5et4k= +github.com/uudashr/gocognit v1.1.3 h1:l+a111VcDbKfynh+airAy/DJQKaXh2m9vkoysMPSZyM= +github.com/uudashr/gocognit v1.1.3/go.mod h1:aKH8/e8xbTRBwjbCkwZ8qt4l2EpKXl31KMHgSS+lZ2U= github.com/vektah/gqlparser/v2 v2.5.16 h1:1gcmLTvs3JLKXckwCwlUagVn/IlV2bwqle0vJ0vy5p8= github.com/vektah/gqlparser/v2 v2.5.16/go.mod h1:1lz1OeCqgQbQepsGxPVywrjdBHW2T08PUS3pJqepRww= github.com/xanzy/ssh-agent v0.3.3 h1:+/15pJfg/RsTxqYcX6fHqOXZwwMP+2VyYWJeWM2qQFM= @@ -543,8 +541,8 @@ go-simpler.org/assert v0.9.0 h1:PfpmcSvL7yAnWyChSjOz6Sp6m9j5lyK8Ok9pEL31YkQ= go-simpler.org/assert v0.9.0/go.mod h1:74Eqh5eI6vCK6Y5l3PI8ZYFXG4Sa+tkr70OIPJAUr28= go-simpler.org/musttag v0.12.2 h1:J7lRc2ysXOq7eM8rwaTYnNrHd5JwjppzB6mScysB2Cs= go-simpler.org/musttag v0.12.2/go.mod h1:uN1DVIasMTQKk6XSik7yrJoEysGtR2GRqvWnI9S7TYM= -go-simpler.org/sloglint v0.7.1 h1:qlGLiqHbN5islOxjeLXoPtUdZXb669RW+BDQ+xOSNoU= -go-simpler.org/sloglint v0.7.1/go.mod h1:OlaVDRh/FKKd4X4sIMbsz8st97vomydceL146Fthh/c= +go-simpler.org/sloglint v0.7.2 h1:Wc9Em/Zeuu7JYpl+oKoYOsQSy2X560aVueCW/m6IijY= +go-simpler.org/sloglint v0.7.2/go.mod h1:US+9C80ppl7VsThQclkM7BkCHQAzuz8kHLsW3ppuluo= go.opentelemetry.io/build-tools v0.15.0 h1:SJFD+MSKKrSIP0oujmmY/zRi8TgVFzUc1080nIBmRzA= go.opentelemetry.io/build-tools v0.15.0/go.mod h1:xyjzzjE7WEtBPVqZ0BwC8RxbGGW3DkD33YFgVLkvOUs= go.opentelemetry.io/build-tools/checkfile v0.15.0 h1:C4qF0t+CMgkNdj125SKwpjjX6RG+NW75KdF9KigbaXk= @@ -648,8 +646,8 @@ golang.org/x/net v0.12.0/go.mod h1:zEVYFnQC7m/vmpQFELhcD1EWkZlX69l4oqgmer6hfKA= golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk= golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= golang.org/x/net v0.22.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg= -golang.org/x/net v0.31.0 h1:68CPQngjLL0r2AlUKiSxtQFKvzRVbnzLwMUn5SzcLHo= -golang.org/x/net v0.31.0/go.mod h1:P4fl1q7dY2hnZFxEk4pPSkDHF+QqjitcnDjUQyMM+pM= +golang.org/x/net v0.32.0 h1:ZqPmj8Kzc+Y6e0+skZsuACbx+wzMgo5MQsJh9Qd6aYI= +golang.org/x/net v0.32.0/go.mod h1:CwU0IoeOlnQQWJ6ioyFrfRuomB8GKF6KbYXZVyeXNfs= golang.org/x/oauth2 v0.23.0 h1:PbgcYx2W7i4LvjJWEbf0ngHV6qJYr86PkAV3bXdLEbs= golang.org/x/oauth2 v0.23.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -678,7 +676,6 @@ golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211105183446-c75c47738b0c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220702020025-31831981b65f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -747,7 +744,6 @@ golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.9/go.mod h1:nABZi5QlRsZVlzPpHl034qft6wpY4eDcsTt5AaioBiU= golang.org/x/tools v0.1.10/go.mod h1:Uh6Zz+xoGYZom868N8YTex3t7RhtHDBrE8Gzo9bV56E= -golang.org/x/tools v0.1.11/go.mod h1:SgwaegtQh8clINPpECJMqnxLv9I09HLqnW3RMqW0CA4= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/tools v0.2.0/go.mod h1:y4OqIKeOV/fWJetJ8bXPU1sEVniLMIyDAZWeHdV+NTA= golang.org/x/tools v0.3.0/go.mod h1:/rWhSS2+zyEVwoJf8YAX6L2f0ntZ7Kn/mGgAWcipA5k= @@ -756,8 +752,8 @@ golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= golang.org/x/tools v0.11.0/go.mod h1:anzJrxPjNtfgiYQYirP2CPGzGLxrH2u2QBhn6Bf3qY8= golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58= golang.org/x/tools v0.19.0/go.mod h1:qoJWxmGSIBmAeriMx19ogtrEPrGtDbPK634QFIcLAhc= -golang.org/x/tools v0.27.0 h1:qEKojBykQkQ4EynWy4S8Weg69NumxKdn40Fce3uc/8o= -golang.org/x/tools v0.27.0/go.mod h1:sUi0ZgbwW9ZPAq26Ekut+weQPR5eIM6GQLQ1Yjm1H0Q= +golang.org/x/tools v0.28.0 h1:WuB6qZ4RPCQo5aP3WdKZS7i595EdWqWR8vqJTlwTVK8= +golang.org/x/tools v0.28.0/go.mod h1:dcIOrVd3mfQKTgrDVQHqCPMWy6lnhfhtX3hLXYVLfRw= golang.org/x/vuln v1.1.3 h1:NPGnvPOTgnjBc9HTaUx+nj+EaUYxl5SJOWqaDYGaFYw= golang.org/x/vuln v1.1.3/go.mod h1:7Le6Fadm5FOqE9C926BCD0g12NWyhg7cxV4BwcPFuNY= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -788,8 +784,8 @@ gotest.tools/gotestsum v1.12.0 h1:CmwtaGDkHxrZm4Ib0Vob89MTfpc3GrEFMJKovliPwGk= gotest.tools/gotestsum v1.12.0/go.mod h1:fAvqkSptospfSbQw26CTYzNwnsE/ztqLeyhP0h67ARY= gotest.tools/v3 v3.5.1 h1:EENdUnS3pdur5nybKYIh2Vfgc8IUNBjxDPSjtiJcOzU= gotest.tools/v3 v3.5.1/go.mod h1:isy3WKz7GK6uNw/sbHzfKBLvlvXwUyV06n6brMxxopU= -honnef.co/go/tools v0.4.7 h1:9MDAWxMoSnB6QoSqiVr7P5mtkT9pOc1kSxchzPCnqJs= -honnef.co/go/tools v0.4.7/go.mod h1:+rnGS1THNh8zMwnd2oVOTL9QF6vmfyG6ZXBULae2uc0= +honnef.co/go/tools v0.5.0 h1:29uoiIormS3Z6R+t56STz/oI4v+mB51TSmEOdJPgRnE= +honnef.co/go/tools v0.5.0/go.mod h1:e9irvo83WDG9/irijV44wr3tbhcFeRnfpVlRqVwpzMs= mvdan.cc/gofumpt v0.6.0 h1:G3QvahNDmpD+Aek/bNOLrFR2XC6ZAdo62dZu65gmwGo= mvdan.cc/gofumpt v0.6.0/go.mod h1:4L0wf+kgIPZtcCWXynNS2e6bhmj73umwnuXSZarixzA= mvdan.cc/unparam v0.0.0-20240528143540-8a5130ca722f h1:lMpcwN6GxNbWtbpI1+xzFLSW8XzX0u72NttUGVFjO3U= diff --git a/pkg/stanza/operator/helper/severity_builder.go b/pkg/stanza/operator/helper/severity_builder.go index 9c488a2d4bca..b0f7ee195e5c 100644 --- a/pkg/stanza/operator/helper/severity_builder.go +++ b/pkg/stanza/operator/helper/severity_builder.go @@ -184,13 +184,13 @@ func isRange(value any) (int, int, bool) { return minInt, maxInt, true } -func expandRange(min, max int) []string { - if min > max { - min, max = max, min +func expandRange(minR, maxR int) []string { + if minR > maxR { + minR, maxR = maxR, minR } var rangeOfStrings []string - for i := min; i <= max; i++ { + for i := minR; i <= maxR; i++ { rangeOfStrings = append(rangeOfStrings, strconv.Itoa(i)) } return rangeOfStrings diff --git a/pkg/stanza/operator/parser/regex/cache.go b/pkg/stanza/operator/parser/regex/cache.go index 50356780284b..737ebcea7391 100644 --- a/pkg/stanza/operator/parser/regex/cache.go +++ b/pkg/stanza/operator/parser/regex/cache.go @@ -129,14 +129,14 @@ type limiter interface { } // newStartedAtomicLimiter returns a started atomicLimiter -func newStartedAtomicLimiter(max uint64, interval uint64) *atomicLimiter { +func newStartedAtomicLimiter(maxVal uint64, interval uint64) *atomicLimiter { if interval == 0 { interval = 5 } a := &atomicLimiter{ count: &atomic.Uint64{}, - max: max, + max: maxVal, interval: time.Second * time.Duration(interval), done: make(chan struct{}), } diff --git a/pkg/stanza/operator/parser/regex/cache_test.go b/pkg/stanza/operator/parser/regex/cache_test.go index 2c68aab69382..d8f3a166ec78 100644 --- a/pkg/stanza/operator/parser/regex/cache_test.go +++ b/pkg/stanza/operator/parser/regex/cache_test.go @@ -191,18 +191,18 @@ func TestNewStartedAtomicLimiter(t *testing.T) { // Start a limiter with a max of 3 and ensure throttling begins func TestLimiter(t *testing.T) { - max := uint64(3) + const maxVal = uint64(3) - l := newStartedAtomicLimiter(max, 120) + l := newStartedAtomicLimiter(maxVal, 120) require.NotNil(t, l) - require.Equal(t, max, l.max) + require.Equal(t, maxVal, l.max) defer l.stop() require.False(t, l.throttled(), "new limiter should not be throttling") require.Equal(t, uint64(0), l.currentCount()) var i uint64 - for i = 1; i < max; i++ { + for i = 1; i < maxVal; i++ { l.increment() require.Equal(t, i, l.currentCount()) require.False(t, l.throttled()) @@ -213,15 +213,15 @@ func TestLimiter(t *testing.T) { } func TestThrottledLimiter(t *testing.T) { - max := uint64(3) + const maxVal = uint64(3) // Limiter with a count higher than the max, which will force // it to be throttled by default. Also note that the init method // has not been called yet, so the reset go routine is not running count := &atomic.Uint64{} - count.Add(max + 1) + count.Add(maxVal + 1) l := atomicLimiter{ - max: max, + max: maxVal, count: count, interval: 1, done: make(chan struct{}), diff --git a/pkg/translator/prometheusremotewrite/helper.go b/pkg/translator/prometheusremotewrite/helper.go index 11f8595adb91..b8ad862124cc 100644 --- a/pkg/translator/prometheusremotewrite/helper.go +++ b/pkg/translator/prometheusremotewrite/helper.go @@ -368,39 +368,32 @@ func mostRecentTimestampInMetric(metric pmetric.Metric) pcommon.Timestamp { case pmetric.MetricTypeGauge: dataPoints := metric.Gauge().DataPoints() for x := 0; x < dataPoints.Len(); x++ { - ts = maxTimestamp(ts, dataPoints.At(x).Timestamp()) + ts = max(ts, dataPoints.At(x).Timestamp()) } case pmetric.MetricTypeSum: dataPoints := metric.Sum().DataPoints() for x := 0; x < dataPoints.Len(); x++ { - ts = maxTimestamp(ts, dataPoints.At(x).Timestamp()) + ts = max(ts, dataPoints.At(x).Timestamp()) } case pmetric.MetricTypeHistogram: dataPoints := metric.Histogram().DataPoints() for x := 0; x < dataPoints.Len(); x++ { - ts = maxTimestamp(ts, dataPoints.At(x).Timestamp()) + ts = max(ts, dataPoints.At(x).Timestamp()) } case pmetric.MetricTypeExponentialHistogram: dataPoints := metric.ExponentialHistogram().DataPoints() for x := 0; x < dataPoints.Len(); x++ { - ts = maxTimestamp(ts, dataPoints.At(x).Timestamp()) + ts = max(ts, dataPoints.At(x).Timestamp()) } case pmetric.MetricTypeSummary: dataPoints := metric.Summary().DataPoints() for x := 0; x < dataPoints.Len(); x++ { - ts = maxTimestamp(ts, dataPoints.At(x).Timestamp()) + ts = max(ts, dataPoints.At(x).Timestamp()) } } return ts } -func maxTimestamp(a, b pcommon.Timestamp) pcommon.Timestamp { - if a > b { - return a - } - return b -} - func (c *prometheusConverter) addSummaryDataPoints(dataPoints pmetric.SummaryDataPointSlice, resource pcommon.Resource, settings Settings, baseName string, ) { diff --git a/pkg/translator/prometheusremotewrite/metrics_to_prw.go b/pkg/translator/prometheusremotewrite/metrics_to_prw.go index 65def1ccfa58..f5a487562ff0 100644 --- a/pkg/translator/prometheusremotewrite/metrics_to_prw.go +++ b/pkg/translator/prometheusremotewrite/metrics_to_prw.go @@ -68,7 +68,7 @@ func (c *prometheusConverter) fromMetrics(md pmetric.Metrics, settings Settings) // TODO: decide if instrumentation library information should be exported as labels for k := 0; k < metricSlice.Len(); k++ { metric := metricSlice.At(k) - mostRecentTimestamp = maxTimestamp(mostRecentTimestamp, mostRecentTimestampInMetric(metric)) + mostRecentTimestamp = max(mostRecentTimestamp, mostRecentTimestampInMetric(metric)) if !isValidAggregationTemporality(metric) { errs = multierr.Append(errs, fmt.Errorf("invalid temporality and type combination for metric %q", metric.Name())) diff --git a/pkg/translator/prometheusremotewrite/metrics_to_prw_v2.go b/pkg/translator/prometheusremotewrite/metrics_to_prw_v2.go index 5ccd4e166e8a..4fde69183f2f 100644 --- a/pkg/translator/prometheusremotewrite/metrics_to_prw_v2.go +++ b/pkg/translator/prometheusremotewrite/metrics_to_prw_v2.go @@ -60,7 +60,7 @@ func (c *prometheusConverterV2) fromMetrics(md pmetric.Metrics, settings Setting // TODO: decide if instrumentation library information should be exported as labels for k := 0; k < metricSlice.Len(); k++ { metric := metricSlice.At(k) - mostRecentTimestamp = maxTimestamp(mostRecentTimestamp, mostRecentTimestampInMetric(metric)) + mostRecentTimestamp = max(mostRecentTimestamp, mostRecentTimestampInMetric(metric)) if !isValidAggregationTemporality(metric) { errs = multierr.Append(errs, fmt.Errorf("invalid temporality and type combination for metric %q", metric.Name())) diff --git a/pkg/translator/signalfx/from_metrics.go b/pkg/translator/signalfx/from_metrics.go index 0d316db4947a..9d10a3491b8b 100644 --- a/pkg/translator/signalfx/from_metrics.go +++ b/pkg/translator/signalfx/from_metrics.go @@ -170,15 +170,15 @@ func convertHistogram(in pmetric.HistogramDataPointSlice, name string, mt *sfxpb if histDP.HasMin() { // Min is always a gauge. minDP := dps.appendPoint(name+"_min", &sfxMetricTypeGauge, ts, dims) - min := histDP.Min() - minDP.Value.DoubleValue = &min + minVal := histDP.Min() + minDP.Value.DoubleValue = &minVal } if histDP.HasMax() { // Max is always a gauge. maxDP := dps.appendPoint(name+"_max", &sfxMetricTypeGauge, ts, dims) - max := histDP.Max() - maxDP.Value.DoubleValue = &max + maxVal := histDP.Max() + maxDP.Value.DoubleValue = &maxVal } // Drop Histogram Buckets if flag is set. diff --git a/processor/deltatocumulativeprocessor/internal/data/expo/scale.go b/processor/deltatocumulativeprocessor/internal/data/expo/scale.go index 5201806fb82f..c19830071eaf 100644 --- a/processor/deltatocumulativeprocessor/internal/data/expo/scale.go +++ b/processor/deltatocumulativeprocessor/internal/data/expo/scale.go @@ -29,7 +29,7 @@ func (scale Scale) Idx(v float64) int { // This means a value min < v <= max belongs to this bucket. // // NOTE: this is different from Go slice intervals, which are [a,b) -func (scale Scale) Bounds(index int) (min, max float64) { +func (scale Scale) Bounds(index int) (minVal, maxVal float64) { // from: https://opentelemetry.io/docs/specs/otel/metrics/data-model/#all-scales-use-the-logarithm-function lower := func(index int) float64 { inverseFactor := math.Ldexp(math.Ln2, int(-scale)) diff --git a/processor/deltatocumulativeprocessor/internal/data/expo/zero.go b/processor/deltatocumulativeprocessor/internal/data/expo/zero.go index 2d5401b39f5c..969c5f2734ad 100644 --- a/processor/deltatocumulativeprocessor/internal/data/expo/zero.go +++ b/processor/deltatocumulativeprocessor/internal/data/expo/zero.go @@ -37,8 +37,8 @@ func WidenZero(dp DataPoint, width float64) { widen(dp.Positive()) widen(dp.Negative()) - _, max := scale.Bounds(zero) - dp.SetZeroThreshold(max) + _, maxVal := scale.Bounds(zero) + dp.SetZeroThreshold(maxVal) } // Slice drops data outside the range from <= i < to from the bucket counts. It behaves the same as Go's [a:b] diff --git a/processor/metricstransformprocessor/metrics_testcase_builder_test.go b/processor/metricstransformprocessor/metrics_testcase_builder_test.go index b50d6923bbe9..d8b7a1e5cc8c 100644 --- a/processor/metricstransformprocessor/metrics_testcase_builder_test.go +++ b/processor/metricstransformprocessor/metrics_testcase_builder_test.go @@ -101,7 +101,7 @@ func (b builder) addHistogramDatapoint(start, ts pcommon.Timestamp, count uint64 return b } -func (b builder) addHistogramDatapointWithMinMaxAndExemplars(start, ts pcommon.Timestamp, count uint64, sum, min, max float64, +func (b builder) addHistogramDatapointWithMinMaxAndExemplars(start, ts pcommon.Timestamp, count uint64, sum, minVal, maxVal float64, bounds []float64, buckets []uint64, exemplarValues []float64, attrValues ...string, ) builder { if b.metric.Type() != pmetric.MetricTypeHistogram { @@ -111,8 +111,8 @@ func (b builder) addHistogramDatapointWithMinMaxAndExemplars(start, ts pcommon.T b.setAttrs(dp.Attributes(), attrValues) dp.SetCount(count) dp.SetSum(sum) - dp.SetMin(min) - dp.SetMax(max) + dp.SetMin(minVal) + dp.SetMax(maxVal) dp.ExplicitBounds().FromRaw(bounds) dp.BucketCounts().FromRaw(buckets) for ei := 0; ei < len(exemplarValues); ei++ { diff --git a/processor/transformprocessor/internal/metrics/func_scale_test.go b/processor/transformprocessor/internal/metrics/func_scale_test.go index 29441bb047fb..735253258292 100644 --- a/processor/transformprocessor/internal/metrics/func_scale_test.go +++ b/processor/transformprocessor/internal/metrics/func_scale_test.go @@ -182,15 +182,15 @@ func TestScale(t *testing.T) { } } -func getTestScalingHistogramMetric(count uint64, sum, min, max float64, bounds []float64, bucketCounts []uint64, exemplars []float64, start, timestamp pcommon.Timestamp) pmetric.Metric { +func getTestScalingHistogramMetric(count uint64, sum, minVal, maxVal float64, bounds []float64, bucketCounts []uint64, exemplars []float64, start, timestamp pcommon.Timestamp) pmetric.Metric { metric := pmetric.NewMetric() metric.SetName("test-metric") metric.SetEmptyHistogram() histogramDatapoint := metric.Histogram().DataPoints().AppendEmpty() histogramDatapoint.SetCount(count) histogramDatapoint.SetSum(sum) - histogramDatapoint.SetMin(min) - histogramDatapoint.SetMax(max) + histogramDatapoint.SetMin(minVal) + histogramDatapoint.SetMax(maxVal) histogramDatapoint.ExplicitBounds().FromRaw(bounds) histogramDatapoint.BucketCounts().FromRaw(bucketCounts) for i := 0; i < len(exemplars); i++ { diff --git a/receiver/awscontainerinsightreceiver/internal/host/utils.go b/receiver/awscontainerinsightreceiver/internal/host/utils.go index 0d25ee458b1e..3fe79032dc2b 100644 --- a/receiver/awscontainerinsightreceiver/internal/host/utils.go +++ b/receiver/awscontainerinsightreceiver/internal/host/utils.go @@ -16,7 +16,7 @@ const ( hostMounts = hostProc + "/mounts" // "/rootfs/proc/mounts" in container refers to "/proc/mounts" in the host ) -func hostJitter(max time.Duration) time.Duration { +func hostJitter(maxDuration time.Duration) time.Duration { hostName, err := os.Hostname() if err != nil { hostName = "Unknown" @@ -24,7 +24,7 @@ func hostJitter(max time.Duration) time.Duration { hash := fnv.New64() hash.Write([]byte(hostName)) // Right shift the uint64 hash by one to make sure the jitter duration is always positive - hostSleepJitter := time.Duration(int64(hash.Sum64()>>1)) % max + hostSleepJitter := time.Duration(int64(hash.Sum64()>>1)) % maxDuration return hostSleepJitter } diff --git a/receiver/awsfirehosereceiver/internal/unmarshaler/cwmetricstream/metricsbuilder.go b/receiver/awsfirehosereceiver/internal/unmarshaler/cwmetricstream/metricsbuilder.go index af47ba4b6509..c39a2c716ee9 100644 --- a/receiver/awsfirehosereceiver/internal/unmarshaler/cwmetricstream/metricsbuilder.go +++ b/receiver/awsfirehosereceiver/internal/unmarshaler/cwmetricstream/metricsbuilder.go @@ -137,12 +137,12 @@ func (mb *metricBuilder) toDataPoint(dp pmetric.SummaryDataPoint, metric cWMetri dp.SetCount(uint64(metric.Value.Count)) dp.SetSum(metric.Value.Sum) qv := dp.QuantileValues() - min := qv.AppendEmpty() - min.SetQuantile(0) - min.SetValue(metric.Value.Min) - max := qv.AppendEmpty() - max.SetQuantile(1) - max.SetValue(metric.Value.Max) + minQ := qv.AppendEmpty() + minQ.SetQuantile(0) + minQ.SetValue(metric.Value.Min) + maxQ := qv.AppendEmpty() + maxQ.SetQuantile(1) + maxQ.SetValue(metric.Value.Max) dp.SetTimestamp(pcommon.NewTimestampFromTime(time.UnixMilli(metric.Timestamp))) for k, v := range metric.Dimensions { dp.Attributes().PutStr(ToSemConvAttributeKey(k), v) diff --git a/receiver/awsfirehosereceiver/internal/unmarshaler/otlpmetricstream/unmarshaler_test.go b/receiver/awsfirehosereceiver/internal/unmarshaler/otlpmetricstream/unmarshaler_test.go index 0f5a1ee3c905..bc1127009997 100644 --- a/receiver/awsfirehosereceiver/internal/unmarshaler/otlpmetricstream/unmarshaler_test.go +++ b/receiver/awsfirehosereceiver/internal/unmarshaler/otlpmetricstream/unmarshaler_test.go @@ -28,12 +28,12 @@ func createMetricRecord() []byte { dp.SetCount(1) dp.SetSum(1) qv := dp.QuantileValues() - min := qv.AppendEmpty() - min.SetQuantile(0) - min.SetValue(0) - max := qv.AppendEmpty() - max.SetQuantile(1) - max.SetValue(1) + minQ := qv.AppendEmpty() + minQ.SetQuantile(0) + minQ.SetValue(0) + maxQ := qv.AppendEmpty() + maxQ.SetQuantile(1) + maxQ.SetValue(1) dp.SetTimestamp(pcommon.NewTimestampFromTime(time.Now())) temp, _ := er.MarshalProto()