From f884170343b8d144d075584e0c38c57f1442a10e Mon Sep 17 00:00:00 2001 From: Alex Boten Date: Thu, 15 Feb 2024 11:56:50 -0800 Subject: [PATCH] [chore] address linting failures (#31286) This is only a part of the failures, but there's so many i'd rather not submit a single massive PR. Related to https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/31240 Signed-off-by: Alex Boten --- receiver/aerospikereceiver/client_test.go | 8 ++--- receiver/aerospikereceiver/scraper_test.go | 2 +- receiver/apachesparkreceiver/scraper_test.go | 10 +++---- .../internal/cadvisor/cadvisor_nolinux.go | 4 +-- .../internal/host/ebsvolume_test.go | 10 +++---- .../internal/host/nodeCapacity_test.go | 12 ++++---- .../internal/translator/translator_test.go | 28 ++++++++--------- receiver/azuremonitorreceiver/scraper.go | 8 ++--- receiver/azuremonitorreceiver/scraper_test.go | 8 ++--- receiver/bigipreceiver/client_test.go | 30 +++++++++---------- receiver/bigipreceiver/integration_test.go | 2 +- receiver/bigipreceiver/scraper_test.go | 14 ++++----- .../internal/chrony/client_test.go | 10 +++---- receiver/elasticsearchreceiver/client.go | 6 ++-- .../filestatsreceiver/integration_test.go | 2 +- receiver/flinkmetricsreceiver/client_test.go | 24 +++++++-------- receiver/flinkmetricsreceiver/scraper_test.go | 12 ++++---- .../scraper/githubscraper/helpers_test.go | 2 +- .../internal/handler_test.go | 2 +- .../internal/filter/itemcardinality_test.go | 4 +-- .../hostmetricsreceiver/integration_test.go | 6 ++-- .../diskscraper/disk_scraper_others_test.go | 2 +- .../filesystem_scraper_test.go | 12 ++++---- .../networkscraper/network_scraper_test.go | 4 +-- .../processes_scraper_test.go | 2 +- .../processscraper/process_scraper_test.go | 4 +-- receiver/httpcheckreceiver/scraper_test.go | 2 +- .../internal/subprocess/integration_test.go | 2 +- receiver/jmxreceiver/receiver_test.go | 4 +-- receiver/k8seventsreceiver/factory_test.go | 2 +- receiver/k8seventsreceiver/receiver_test.go | 2 +- .../broker_scraper_test.go | 4 +-- .../kafkametricsreceiver/consumer_scraper.go | 6 ++-- .../consumer_scraper_test.go | 8 ++--- receiver/kafkametricsreceiver/factory_test.go | 2 +- .../kafkametricsreceiver/receiver_test.go | 2 +- .../topic_scraper_test.go | 4 +-- .../internal/kubelet/accumulator_test.go | 2 +- .../internal/kubelet/metadata_test.go | 2 +- .../internal/kubelet/volume_test.go | 8 ++--- receiver/memcachedreceiver/scraper_test.go | 2 +- receiver/mongodbreceiver/scraper_test.go | 6 ++-- receiver/mysqlreceiver/client.go | 4 +-- receiver/mysqlreceiver/scraper_test.go | 2 +- 44 files changed, 146 insertions(+), 146 deletions(-) diff --git a/receiver/aerospikereceiver/client_test.go b/receiver/aerospikereceiver/client_test.go index f6e57975f18d..9934b3efad5b 100644 --- a/receiver/aerospikereceiver/client_test.go +++ b/receiver/aerospikereceiver/client_test.go @@ -48,7 +48,7 @@ func TestAerospike_Info(t *testing.T) { logger: logger.Sugar(), } - nodeGetterFactoryFunc := func(cfg *clientConfig, policy *as.ClientPolicy, authEnabled bool) (nodeGetter, error) { + nodeGetterFactoryFunc := func(*clientConfig, *as.ClientPolicy, bool) (nodeGetter, error) { return testCluster, nil } @@ -111,7 +111,7 @@ func TestAerospike_NamespaceInfo(t *testing.T) { logger: logger.Sugar(), } - nodeGetterFactoryFunc := func(cfg *clientConfig, policy *as.ClientPolicy, authEnabled bool) (nodeGetter, error) { + nodeGetterFactoryFunc := func(*clientConfig, *as.ClientPolicy, bool) (nodeGetter, error) { return testCluster, nil } @@ -170,7 +170,7 @@ func TestAerospike_NamespaceInfo_Negative(t *testing.T) { testClusterNeg.On("GetNodes").Return(testNodesNeg) testClusterNeg.On("Close").Return() - nodeGetterFactoryFuncNeg := func(cfg *clientConfig, policy *as.ClientPolicy, authEnabled bool) (nodeGetter, error) { + nodeGetterFactoryFuncNeg := func(*clientConfig, *as.ClientPolicy, bool) (nodeGetter, error) { return testClusterNeg, nil } @@ -202,7 +202,7 @@ func TestAerospike_NamespaceInfo_Negative(t *testing.T) { testClusterNeg.On("GetNodes").Return(testNodesNeg) testClusterNeg.On("Close").Return() - nodeGetterFactoryFuncNeg = func(cfg *clientConfig, policy *as.ClientPolicy, authEnabled bool) (nodeGetter, error) { + nodeGetterFactoryFuncNeg = func(*clientConfig, *as.ClientPolicy, bool) (nodeGetter, error) { return testClusterNeg, nil } diff --git a/receiver/aerospikereceiver/scraper_test.go b/receiver/aerospikereceiver/scraper_test.go index 1f1fd9d123e5..fe8487bc9b28 100644 --- a/receiver/aerospikereceiver/scraper_test.go +++ b/receiver/aerospikereceiver/scraper_test.go @@ -41,7 +41,7 @@ func TestNewAerospikeReceiver_BadEndpoint(t *testing.T) { }, } - cs, err := consumer.NewMetrics(func(ctx context.Context, ld pmetric.Metrics) error { return nil }) + cs, err := consumer.NewMetrics(func(context.Context, pmetric.Metrics) error { return nil }) require.NoError(t, err) for _, tc := range testCases { diff --git a/receiver/apachesparkreceiver/scraper_test.go b/receiver/apachesparkreceiver/scraper_test.go index 4a93d110d945..45cc574bb5b7 100644 --- a/receiver/apachesparkreceiver/scraper_test.go +++ b/receiver/apachesparkreceiver/scraper_test.go @@ -44,12 +44,12 @@ func TestScraper(t *testing.T) { }{ { desc: "Exits on failure to get app ids", - setupMockClient: func(t *testing.T) client { + setupMockClient: func(*testing.T) client { mockClient := mocks.MockClient{} mockClient.On("Applications").Return(nil, errors.New("could not retrieve app ids")) return &mockClient }, - expectedMetricGen: func(t *testing.T) pmetric.Metrics { + expectedMetricGen: func(*testing.T) pmetric.Metrics { return pmetric.NewMetrics() }, config: createDefaultConfig().(*Config), @@ -57,12 +57,12 @@ func TestScraper(t *testing.T) { }, { desc: "No Matching Allowed Apps", - setupMockClient: func(t *testing.T) client { + setupMockClient: func(*testing.T) client { mockClient := mocks.MockClient{} mockClient.On("Applications").Return([]models.Application{}, nil) return &mockClient }, - expectedMetricGen: func(t *testing.T) pmetric.Metrics { + expectedMetricGen: func(*testing.T) pmetric.Metrics { return pmetric.NewMetrics() }, config: &Config{ScraperControllerSettings: scraperhelper.ScraperControllerSettings{ @@ -78,7 +78,7 @@ func TestScraper(t *testing.T) { }, { desc: "Successful Full Empty Collection", - setupMockClient: func(t *testing.T) client { + setupMockClient: func(*testing.T) client { mockClient := mocks.MockClient{} mockClient.On("ClusterStats").Return(&models.ClusterProperties{}, nil) mockClient.On("Applications").Return([]models.Application{}, nil) diff --git a/receiver/awscontainerinsightreceiver/internal/cadvisor/cadvisor_nolinux.go b/receiver/awscontainerinsightreceiver/internal/cadvisor/cadvisor_nolinux.go index 053d9b535042..6c12e9ee43c8 100644 --- a/receiver/awscontainerinsightreceiver/internal/cadvisor/cadvisor_nolinux.go +++ b/receiver/awscontainerinsightreceiver/internal/cadvisor/cadvisor_nolinux.go @@ -34,13 +34,13 @@ type Option func(*Cadvisor) // WithDecorator constructs an option for configuring the metric decorator func WithDecorator(_ any) Option { - return func(c *Cadvisor) { + return func(*Cadvisor) { // do nothing } } func WithECSInfoCreator(_ any) Option { - return func(c *Cadvisor) { + return func(*Cadvisor) { // do nothing } } diff --git a/receiver/awscontainerinsightreceiver/internal/host/ebsvolume_test.go b/receiver/awscontainerinsightreceiver/internal/host/ebsvolume_test.go index a2495704f6d4..b24ce9030524 100644 --- a/receiver/awscontainerinsightreceiver/internal/host/ebsvolume_test.go +++ b/receiver/awscontainerinsightreceiver/internal/host/ebsvolume_test.go @@ -169,9 +169,9 @@ func TestEBSVolume(t *testing.T) { assert.Equal(t, "aws://us-west-2/vol-0c241693efb58734a", e.getEBSVolumeID("/dev/nvme0n2")) assert.Equal(t, "", e.getEBSVolumeID("/dev/invalid")) - ebsIds := e.extractEbsIDsUsedByKubernetes() - assert.Equal(t, 1, len(ebsIds)) - assert.Equal(t, "aws://us-west-2b/vol-0d9f0816149eb2050", ebsIds["/dev/nvme1n1"]) + ebsIDs := e.extractEbsIDsUsedByKubernetes() + assert.Equal(t, 1, len(ebsIDs)) + assert.Equal(t, "aws://us-west-2b/vol-0d9f0816149eb2050", ebsIDs["/dev/nvme1n1"]) // set e.hostMounts to an invalid path hostMountsOption = func(e *ebsVolume) { @@ -179,6 +179,6 @@ func TestEBSVolume(t *testing.T) { } e = newEBSVolume(ctx, sess, "instanceId", "us-west-2", time.Millisecond, zap.NewNop(), clientOption, maxJitterOption, hostMountsOption, LstatOption, evalSymLinksOption) - ebsIds = e.extractEbsIDsUsedByKubernetes() - assert.Equal(t, 0, len(ebsIds)) + ebsIDs = e.extractEbsIDsUsedByKubernetes() + assert.Equal(t, 0, len(ebsIDs)) } diff --git a/receiver/awscontainerinsightreceiver/internal/host/nodeCapacity_test.go b/receiver/awscontainerinsightreceiver/internal/host/nodeCapacity_test.go index 82568c8922ba..84a060777b0d 100644 --- a/receiver/awscontainerinsightreceiver/internal/host/nodeCapacity_test.go +++ b/receiver/awscontainerinsightreceiver/internal/host/nodeCapacity_test.go @@ -18,7 +18,7 @@ import ( func TestNodeCapacity(t *testing.T) { // no proc directory lstatOption := func(nc *nodeCapacity) { - nc.osLstat = func(name string) (os.FileInfo, error) { + nc.osLstat = func(string) (os.FileInfo, error) { return nil, os.ErrNotExist } } @@ -28,18 +28,18 @@ func TestNodeCapacity(t *testing.T) { // can't set environment variables lstatOption = func(nc *nodeCapacity) { - nc.osLstat = func(name string) (os.FileInfo, error) { + nc.osLstat = func(string) (os.FileInfo, error) { return nil, nil } } virtualMemOption := func(nc *nodeCapacity) { - nc.virtualMemory = func(ctx context.Context) (*mem.VirtualMemoryStat, error) { + nc.virtualMemory = func(context.Context) (*mem.VirtualMemoryStat, error) { return nil, errors.New("error") } } cpuInfoOption := func(nc *nodeCapacity) { - nc.cpuInfo = func(ctx context.Context) ([]cpu.InfoStat, error) { + nc.cpuInfo = func(context.Context) ([]cpu.InfoStat, error) { return nil, errors.New("error") } } @@ -51,14 +51,14 @@ func TestNodeCapacity(t *testing.T) { // normal case where everything is working virtualMemOption = func(nc *nodeCapacity) { - nc.virtualMemory = func(ctx context.Context) (*mem.VirtualMemoryStat, error) { + nc.virtualMemory = func(context.Context) (*mem.VirtualMemoryStat, error) { return &mem.VirtualMemoryStat{ Total: 1024, }, nil } } cpuInfoOption = func(nc *nodeCapacity) { - nc.cpuInfo = func(ctx context.Context) ([]cpu.InfoStat, error) { + nc.cpuInfo = func(context.Context) ([]cpu.InfoStat, error) { return []cpu.InfoStat{ {}, {}, diff --git a/receiver/awsxrayreceiver/internal/translator/translator_test.go b/receiver/awsxrayreceiver/internal/translator/translator_test.go index 748084cc0f0b..dc4550b27591 100644 --- a/receiver/awsxrayreceiver/internal/translator/translator_test.go +++ b/receiver/awsxrayreceiver/internal/translator/translator_test.go @@ -663,19 +663,19 @@ func TestTranslation(t *testing.T) { { testCase: "TranslateInvalidNamespace", samplePath: filepath.Join("../../../../internal/aws/xray", "testdata", "invalidNamespace.txt"), - expectedResourceAttrs: func(seg *awsxray.Segment) map[string]any { + expectedResourceAttrs: func(*awsxray.Segment) map[string]any { return nil }, expectedRecord: xray.TelemetryRecord{ SegmentsReceivedCount: aws.Int64(18), SegmentsRejectedCount: aws.Int64(18), }, - propsPerSpan: func(_ string, _ *testing.T, seg *awsxray.Segment) []perSpanProperties { + propsPerSpan: func(string, *testing.T, *awsxray.Segment) []perSpanProperties { return nil }, verification: func(testCase string, actualSeg *awsxray.Segment, - expectedRs ptrace.ResourceSpans, actualTraces ptrace.Traces, err error) { + _ ptrace.ResourceSpans, _ ptrace.Traces, err error) { assert.EqualError(t, err, fmt.Sprintf("unexpected namespace: %s", *actualSeg.Subsegments[0].Subsegments[0].Namespace), @@ -831,19 +831,19 @@ func TestTranslation(t *testing.T) { { testCase: "TranslateInvalidSqlUrl", samplePath: filepath.Join("../../../../internal/aws/xray", "testdata", "indepSubsegmentWithInvalidSqlUrl.txt"), - expectedResourceAttrs: func(seg *awsxray.Segment) map[string]any { + expectedResourceAttrs: func(*awsxray.Segment) map[string]any { return nil }, expectedRecord: xray.TelemetryRecord{ SegmentsReceivedCount: aws.Int64(1), SegmentsRejectedCount: aws.Int64(1), }, - propsPerSpan: func(_ string, _ *testing.T, seg *awsxray.Segment) []perSpanProperties { + propsPerSpan: func(string, *testing.T, *awsxray.Segment) []perSpanProperties { return nil }, verification: func(testCase string, actualSeg *awsxray.Segment, - expectedRs ptrace.ResourceSpans, actualTraces ptrace.Traces, err error) { + _ ptrace.ResourceSpans, _ ptrace.Traces, err error) { assert.EqualError(t, err, fmt.Sprintf( "failed to parse out the database name in the \"sql.url\" field, rawUrl: %s", @@ -856,19 +856,19 @@ func TestTranslation(t *testing.T) { testCase: "TranslateJsonUnmarshallFailed", expectedUnmarshallFailure: true, samplePath: filepath.Join("../../../../internal/aws/xray", "testdata", "minCauseIsInvalid.txt"), - expectedResourceAttrs: func(seg *awsxray.Segment) map[string]any { + expectedResourceAttrs: func(*awsxray.Segment) map[string]any { return nil }, expectedRecord: xray.TelemetryRecord{ SegmentsReceivedCount: aws.Int64(0), SegmentsRejectedCount: aws.Int64(0), }, - propsPerSpan: func(_ string, _ *testing.T, seg *awsxray.Segment) []perSpanProperties { + propsPerSpan: func(string, *testing.T, *awsxray.Segment) []perSpanProperties { return nil }, verification: func(testCase string, - actualSeg *awsxray.Segment, - expectedRs ptrace.ResourceSpans, actualTraces ptrace.Traces, err error) { + _ *awsxray.Segment, + _ ptrace.ResourceSpans, _ ptrace.Traces, err error) { assert.EqualError(t, err, fmt.Sprintf( "the value assigned to the `cause` field does not appear to be a string: %v", @@ -880,19 +880,19 @@ func TestTranslation(t *testing.T) { { testCase: "TranslateRootSegValidationFailed", samplePath: filepath.Join("../../../../internal/aws/xray", "testdata", "segmentValidationFailed.txt"), - expectedResourceAttrs: func(seg *awsxray.Segment) map[string]any { + expectedResourceAttrs: func(*awsxray.Segment) map[string]any { return nil }, expectedRecord: xray.TelemetryRecord{ SegmentsReceivedCount: aws.Int64(1), SegmentsRejectedCount: aws.Int64(1), }, - propsPerSpan: func(_ string, _ *testing.T, seg *awsxray.Segment) []perSpanProperties { + propsPerSpan: func(string, *testing.T, *awsxray.Segment) []perSpanProperties { return nil }, verification: func(testCase string, - actualSeg *awsxray.Segment, - expectedRs ptrace.ResourceSpans, actualTraces ptrace.Traces, err error) { + _ *awsxray.Segment, + _ ptrace.ResourceSpans, _ ptrace.Traces, err error) { assert.EqualError(t, err, `segment "start_time" can not be nil`, testCase+": translation should've failed") }, diff --git a/receiver/azuremonitorreceiver/scraper.go b/receiver/azuremonitorreceiver/scraper.go index 597d8f4a4eb7..76492a47c55c 100644 --- a/receiver/azuremonitorreceiver/scraper.go +++ b/receiver/azuremonitorreceiver/scraper.go @@ -193,18 +193,18 @@ func (s *azureScraper) loadCredentials() (err error) { func (s *azureScraper) scrape(ctx context.Context) (pmetric.Metrics, error) { s.getResources(ctx) - resourcesIdsWithDefinitions := make(chan string) + resourcesIDsWithDefinitions := make(chan string) go func() { - defer close(resourcesIdsWithDefinitions) + defer close(resourcesIDsWithDefinitions) for resourceID := range s.resources { s.getResourceMetricsDefinitions(ctx, resourceID) - resourcesIdsWithDefinitions <- resourceID + resourcesIDsWithDefinitions <- resourceID } }() var wg sync.WaitGroup - for resourceID := range resourcesIdsWithDefinitions { + for resourceID := range resourcesIDsWithDefinitions { wg.Add(1) go func(resourceID string) { defer wg.Done() diff --git a/receiver/azuremonitorreceiver/scraper_test.go b/receiver/azuremonitorreceiver/scraper_test.go index bd6151ed2381..200f3001e6b5 100644 --- a/receiver/azuremonitorreceiver/scraper_test.go +++ b/receiver/azuremonitorreceiver/scraper_test.go @@ -150,10 +150,10 @@ type armClientMock struct { func (acm *armClientMock) NewListPager(_ *armresources.ClientListOptions) *runtime.Pager[armresources.ClientListResponse] { return runtime.NewPager(runtime.PagingHandler[armresources.ClientListResponse]{ - More: func(page armresources.ClientListResponse) bool { + More: func(armresources.ClientListResponse) bool { return acm.current < len(acm.pages) }, - Fetcher: func(ctx context.Context, page *armresources.ClientListResponse) (armresources.ClientListResponse, error) { + Fetcher: func(context.Context, *armresources.ClientListResponse) (armresources.ClientListResponse, error) { currentPage := acm.pages[acm.current] acm.current++ return currentPage, nil @@ -168,10 +168,10 @@ type metricsDefinitionsClientMock struct { func (mdcm *metricsDefinitionsClientMock) NewListPager(resourceURI string, _ *armmonitor.MetricDefinitionsClientListOptions) *runtime.Pager[armmonitor.MetricDefinitionsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[armmonitor.MetricDefinitionsClientListResponse]{ - More: func(page armmonitor.MetricDefinitionsClientListResponse) bool { + More: func(armmonitor.MetricDefinitionsClientListResponse) bool { return mdcm.current[resourceURI] < len(mdcm.pages[resourceURI]) }, - Fetcher: func(ctx context.Context, page *armmonitor.MetricDefinitionsClientListResponse) (armmonitor.MetricDefinitionsClientListResponse, error) { + Fetcher: func(context.Context, *armmonitor.MetricDefinitionsClientListResponse) (armmonitor.MetricDefinitionsClientListResponse, error) { currentPage := mdcm.pages[resourceURI][mdcm.current[resourceURI]] mdcm.current[resourceURI]++ return currentPage, nil diff --git a/receiver/bigipreceiver/client_test.go b/receiver/bigipreceiver/client_test.go index 0353f292f418..21a117de939a 100644 --- a/receiver/bigipreceiver/client_test.go +++ b/receiver/bigipreceiver/client_test.go @@ -108,7 +108,7 @@ func TestGetNewToken(t *testing.T) { desc: "Non-200 Response", testFunc: func(t *testing.T) { // Setup test server - ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) { w.WriteHeader(http.StatusUnauthorized) })) defer ts.Close() @@ -125,7 +125,7 @@ func TestGetNewToken(t *testing.T) { desc: "Bad payload returned", testFunc: func(t *testing.T) { // Setup test server - ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) { _, err := w.Write([]byte("[{}]")) require.NoError(t, err) })) @@ -145,7 +145,7 @@ func TestGetNewToken(t *testing.T) { data := loadAPIResponseData(t, loginResponseFile) // Setup test server - ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) { _, err := w.Write(data) require.NoError(t, err) })) @@ -356,7 +356,7 @@ func TestGetVirtualServers(t *testing.T) { desc: "Successful call empty body", testFunc: func(t *testing.T) { // Setup test server - ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) { _, err := w.Write([]byte("{}")) require.NoError(t, err) })) @@ -386,7 +386,7 @@ func TestGetPools(t *testing.T) { desc: "Non-200 Response", testFunc: func(t *testing.T) { // Setup test server - ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) { w.WriteHeader(http.StatusUnauthorized) })) defer ts.Close() @@ -402,7 +402,7 @@ func TestGetPools(t *testing.T) { desc: "Bad payload returned", testFunc: func(t *testing.T) { // Setup test server - ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) { _, err := w.Write([]byte("[{}]")) require.NoError(t, err) })) @@ -421,7 +421,7 @@ func TestGetPools(t *testing.T) { data := loadAPIResponseData(t, poolsStatsResponseFile) // Setup test server - ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) { _, err := w.Write(data) require.NoError(t, err) })) @@ -443,7 +443,7 @@ func TestGetPools(t *testing.T) { desc: "Successful call empty body", testFunc: func(t *testing.T) { // Setup test server - ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) { _, err := w.Write([]byte("{}")) require.NoError(t, err) })) @@ -473,7 +473,7 @@ func TestGetPoolMembers(t *testing.T) { desc: "Non-200 Response for all", testFunc: func(t *testing.T) { // Setup test server - ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) { w.WriteHeader(http.StatusUnauthorized) })) defer ts.Close() @@ -493,7 +493,7 @@ func TestGetPoolMembers(t *testing.T) { desc: "Bad payload returned for all", testFunc: func(t *testing.T) { // Setup test server - ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) { _, err := w.Write([]byte("[{}]")) require.NoError(t, err) })) @@ -605,7 +605,7 @@ func TestGetPoolMembers(t *testing.T) { desc: "Successful call empty body for all", testFunc: func(t *testing.T) { // Setup test server - ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) { _, err := w.Write([]byte("{}")) require.NoError(t, err) })) @@ -639,7 +639,7 @@ func TestGetNodes(t *testing.T) { desc: "Non-200 Response", testFunc: func(t *testing.T) { // Setup test server - ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) { w.WriteHeader(http.StatusUnauthorized) })) defer ts.Close() @@ -655,7 +655,7 @@ func TestGetNodes(t *testing.T) { desc: "Bad payload returned", testFunc: func(t *testing.T) { // Setup test server - ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) { _, err := w.Write([]byte("[{}]")) require.NoError(t, err) })) @@ -674,7 +674,7 @@ func TestGetNodes(t *testing.T) { data := loadAPIResponseData(t, nodesStatsResponseFile) // Setup test server - ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) { _, err := w.Write(data) require.NoError(t, err) })) @@ -696,7 +696,7 @@ func TestGetNodes(t *testing.T) { desc: "Successful call empty body", testFunc: func(t *testing.T) { // Setup test server - ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) { _, err := w.Write([]byte("{}")) require.NoError(t, err) })) diff --git a/receiver/bigipreceiver/integration_test.go b/receiver/bigipreceiver/integration_test.go index 435fed00809f..8cd950ab7547 100644 --- a/receiver/bigipreceiver/integration_test.go +++ b/receiver/bigipreceiver/integration_test.go @@ -29,7 +29,7 @@ func TestIntegration(t *testing.T) { scraperinttest.NewIntegrationTest( NewFactory(), scraperinttest.WithCustomConfig( - func(t *testing.T, cfg component.Config, ci *scraperinttest.ContainerInfo) { + func(_ *testing.T, cfg component.Config, _ *scraperinttest.ContainerInfo) { rCfg := cfg.(*Config) rCfg.CollectionInterval = 100 * time.Millisecond rCfg.Endpoint = mockServer.URL diff --git a/receiver/bigipreceiver/scraper_test.go b/receiver/bigipreceiver/scraper_test.go index f7a2c0bea0e8..066a289c19be 100644 --- a/receiver/bigipreceiver/scraper_test.go +++ b/receiver/bigipreceiver/scraper_test.go @@ -85,29 +85,29 @@ func TestScaperScrape(t *testing.T) { }{ { desc: "Nil client", - setupMockClient: func(t *testing.T) client { + setupMockClient: func(*testing.T) client { return nil }, - expectedMetricGen: func(t *testing.T) pmetric.Metrics { + expectedMetricGen: func(*testing.T) pmetric.Metrics { return pmetric.NewMetrics() }, expectedErr: errClientNotInit, }, { desc: "Login API Call Failure", - setupMockClient: func(t *testing.T) client { + setupMockClient: func(*testing.T) client { mockClient := mocks.MockClient{} mockClient.On("GetNewToken", mock.Anything).Return(errors.New("some api error")) return &mockClient }, - expectedMetricGen: func(t *testing.T) pmetric.Metrics { + expectedMetricGen: func(*testing.T) pmetric.Metrics { return pmetric.NewMetrics() }, expectedErr: errors.New("some api error"), }, { desc: "Get API Calls All Failure", - setupMockClient: func(t *testing.T) client { + setupMockClient: func(*testing.T) client { mockClient := mocks.MockClient{} mockClient.On("GetNewToken", mock.Anything).Return(nil) mockClient.On("GetVirtualServers", mock.Anything).Return(nil, errors.New("some virtual api error")) @@ -116,14 +116,14 @@ func TestScaperScrape(t *testing.T) { mockClient.On("GetNodes", mock.Anything).Return(nil, errors.New("some node api error")) return &mockClient }, - expectedMetricGen: func(t *testing.T) pmetric.Metrics { + expectedMetricGen: func(*testing.T) pmetric.Metrics { return pmetric.NewMetrics() }, expectedErr: errors.New("failed to scrape any metrics"), }, { desc: "Successful Full Empty Collection", - setupMockClient: func(t *testing.T) client { + setupMockClient: func(*testing.T) client { mockClient := mocks.MockClient{} mockClient.On("GetNewToken", mock.Anything).Return(nil) mockClient.On("GetVirtualServers", mock.Anything).Return(&models.VirtualServers{}, nil) diff --git a/receiver/chronyreceiver/internal/chrony/client_test.go b/receiver/chronyreceiver/internal/chrony/client_test.go index ede4490a8492..dd6733b07ce8 100644 --- a/receiver/chronyreceiver/internal/chrony/client_test.go +++ b/receiver/chronyreceiver/internal/chrony/client_test.go @@ -40,7 +40,7 @@ func newMockConn(tb testing.TB, serverReaderFn, serverWriterFn func(net.Conn) er assert.NoError(tb, serverReaderFn(server), "Must not error when reading binary data") if serverWriterFn == nil { - serverWriterFn = func(conn net.Conn) error { + serverWriterFn = func(net.Conn) error { return nil } } @@ -154,7 +154,7 @@ func TestGettingTrackingData(t *testing.T) { scenario: "Timeout waiting for dial", timeout: 10 * time.Millisecond, dialTime: 100 * time.Millisecond, - serverReaderFn: func(conn net.Conn) error { + serverReaderFn: func(net.Conn) error { return nil }, err: os.ErrDeadlineExceeded, @@ -162,7 +162,7 @@ func TestGettingTrackingData(t *testing.T) { { scenario: "Timeout waiting for response", timeout: 10 * time.Millisecond, - serverReaderFn: func(conn net.Conn) error { + serverReaderFn: func(net.Conn) error { time.Sleep(100 * time.Millisecond) return nil }, @@ -172,7 +172,7 @@ func TestGettingTrackingData(t *testing.T) { scenario: "Timeout waiting for response because of slow dial", timeout: 100 * time.Millisecond, dialTime: 90 * time.Millisecond, - serverWriterFn: func(conn net.Conn) error { + serverWriterFn: func(net.Conn) error { time.Sleep(20 * time.Millisecond) return nil }, @@ -212,7 +212,7 @@ func TestGettingTrackingData(t *testing.T) { t.Parallel() client, err := New(fmt.Sprintf("unix://%s", t.TempDir()), tc.timeout, func(c *client) { - c.dialer = func(ctx context.Context, _, _ string) (net.Conn, error) { + c.dialer = func(context.Context, string, string) (net.Conn, error) { if tc.dialTime > tc.timeout { return nil, os.ErrDeadlineExceeded } diff --git a/receiver/elasticsearchreceiver/client.go b/receiver/elasticsearchreceiver/client.go index 864fcb39f5b4..954e71993d25 100644 --- a/receiver/elasticsearchreceiver/client.go +++ b/receiver/elasticsearchreceiver/client.go @@ -106,10 +106,10 @@ const ( indexStatsMetrics = "_all" ) -func (c defaultElasticsearchClient) Nodes(ctx context.Context, nodeIds []string) (*model.Nodes, error) { +func (c defaultElasticsearchClient) Nodes(ctx context.Context, nodeIDs []string) (*model.Nodes, error) { var nodeSpec string - if len(nodeIds) > 0 { - nodeSpec = strings.Join(nodeIds, ",") + if len(nodeIDs) > 0 { + nodeSpec = strings.Join(nodeIDs, ",") } else { nodeSpec = "_all" } diff --git a/receiver/filestatsreceiver/integration_test.go b/receiver/filestatsreceiver/integration_test.go index 53a1ff175a86..821483afa4b6 100644 --- a/receiver/filestatsreceiver/integration_test.go +++ b/receiver/filestatsreceiver/integration_test.go @@ -22,7 +22,7 @@ func Test_Integration(t *testing.T) { scraperinttest.NewIntegrationTest( NewFactory(), scraperinttest.WithCustomConfig( - func(t *testing.T, cfg component.Config, ci *scraperinttest.ContainerInfo) { + func(_ *testing.T, cfg component.Config, _ *scraperinttest.ContainerInfo) { rCfg := cfg.(*Config) rCfg.CollectionInterval = time.Second rCfg.Include = "filestats_*" diff --git a/receiver/flinkmetricsreceiver/client_test.go b/receiver/flinkmetricsreceiver/client_test.go index 73ad35b0a788..8cb23c2c4c1f 100644 --- a/receiver/flinkmetricsreceiver/client_test.go +++ b/receiver/flinkmetricsreceiver/client_test.go @@ -33,7 +33,7 @@ const ( vertices = "vertices.json" jobmanagerMetricValues = "jobmanager_metric_values.json" jobsOverview = "jobs_overview.json" - taskmanagerIds = "taskmanager_ids.json" + taskmanagerIDs = "taskmanager_ids.json" taskmanagerMetricValues = "taskmanager_metric_values.json" // regex for endpoint matching @@ -125,7 +125,7 @@ func TestGetJobmanagerMetrics(t *testing.T) { { desc: "Non-200 Response", testFunc: func(t *testing.T) { - ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) { w.WriteHeader(http.StatusUnauthorized) })) defer ts.Close() @@ -140,7 +140,7 @@ func TestGetJobmanagerMetrics(t *testing.T) { { desc: "Bad payload returned", testFunc: func(t *testing.T) { - ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) { _, err := w.Write([]byte("{")) require.NoError(t, err) })) @@ -157,7 +157,7 @@ func TestGetJobmanagerMetrics(t *testing.T) { desc: "Successful call", testFunc: func(t *testing.T) { jobmanagerMetricValuesData := loadAPIResponseData(t, apiResponses, jobmanagerMetricValues) - ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) { _, err := w.Write(jobmanagerMetricValuesData) require.NoError(t, err) })) @@ -194,7 +194,7 @@ func TestGetTaskmanagersMetrics(t *testing.T) { { desc: "Non-200 Response", testFunc: func(t *testing.T) { - ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) { w.WriteHeader(http.StatusUnauthorized) })) defer ts.Close() @@ -209,7 +209,7 @@ func TestGetTaskmanagersMetrics(t *testing.T) { { desc: "Bad taskmanagers payload returned", testFunc: func(t *testing.T) { - ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) { _, err := w.Write([]byte(`{`)) require.NoError(t, err) })) @@ -225,7 +225,7 @@ func TestGetTaskmanagersMetrics(t *testing.T) { { desc: "Bad taskmanagers metrics payload returned", testFunc: func(t *testing.T) { - taskmanagerIDs := loadAPIResponseData(t, apiResponses, taskmanagerIds) + taskmanagerIDs := loadAPIResponseData(t, apiResponses, taskmanagerIDs) ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { if match, _ := regexp.MatchString(taskmanagerIDsRegex, r.URL.Path); match { _, err := w.Write(taskmanagerIDs) @@ -248,7 +248,7 @@ func TestGetTaskmanagersMetrics(t *testing.T) { { desc: "Successful call", testFunc: func(t *testing.T) { - taskmanagerIDs := loadAPIResponseData(t, apiResponses, taskmanagerIds) + taskmanagerIDs := loadAPIResponseData(t, apiResponses, taskmanagerIDs) taskmanagerMetricValuesData := loadAPIResponseData(t, apiResponses, taskmanagerMetricValues) ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { if match, _ := regexp.MatchString(taskmanagerIDsRegex, r.URL.Path); match { @@ -295,7 +295,7 @@ func TestGetJobsMetrics(t *testing.T) { { desc: "Non-200 Response", testFunc: func(t *testing.T) { - ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) { w.WriteHeader(http.StatusUnauthorized) })) defer ts.Close() @@ -310,7 +310,7 @@ func TestGetJobsMetrics(t *testing.T) { { desc: "Bad payload returned", testFunc: func(t *testing.T) { - ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) { _, err := w.Write([]byte(`{`)) require.NoError(t, err) })) @@ -397,7 +397,7 @@ func TestGetSubtasksMetrics(t *testing.T) { { desc: "Non-200 Response", testFunc: func(t *testing.T) { - ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) { w.WriteHeader(http.StatusUnauthorized) })) defer ts.Close() @@ -412,7 +412,7 @@ func TestGetSubtasksMetrics(t *testing.T) { { desc: "Bad payload returned", testFunc: func(t *testing.T) { - ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) { _, err := w.Write([]byte("{")) require.NoError(t, err) })) diff --git a/receiver/flinkmetricsreceiver/scraper_test.go b/receiver/flinkmetricsreceiver/scraper_test.go index 16ae32076339..ab02aa118d98 100644 --- a/receiver/flinkmetricsreceiver/scraper_test.go +++ b/receiver/flinkmetricsreceiver/scraper_test.go @@ -151,7 +151,7 @@ func TestScraperScrape(t *testing.T) { }{ { desc: "Nil client", - setupMockClient: func(t *testing.T) client { + setupMockClient: func(*testing.T) client { return nil }, expectedMetricFile: filepath.Join("testdata", "expected_metrics", "no_metrics.yaml"), @@ -159,7 +159,7 @@ func TestScraperScrape(t *testing.T) { }, { desc: "API Call Failure on Jobmanagers", - setupMockClient: func(t *testing.T) client { + setupMockClient: func(*testing.T) client { mockClient := mocks.MockClient{} mockClient.On("GetJobmanagerMetrics", mock.Anything).Return(&models.JobmanagerMetrics{}, errors.New("some api error")) mockClient.On("GetTaskmanagersMetrics", mock.Anything).Return(nil, nil) @@ -172,7 +172,7 @@ func TestScraperScrape(t *testing.T) { }, { desc: "API Call Failure on Taskmanagers", - setupMockClient: func(t *testing.T) client { + setupMockClient: func(*testing.T) client { mockClient := mocks.MockClient{} mockClient.On("GetJobmanagerMetrics", mock.Anything).Return(&jobmanagerMetrics, nil) mockClient.On("GetTaskmanagersMetrics", mock.Anything).Return(nil, errors.New("some api error")) @@ -185,7 +185,7 @@ func TestScraperScrape(t *testing.T) { }, { desc: "API Call Failure on Jobs", - setupMockClient: func(t *testing.T) client { + setupMockClient: func(*testing.T) client { mockClient := mocks.MockClient{} mockClient.On("GetJobmanagerMetrics", mock.Anything).Return(&jobmanagerMetrics, nil) mockClient.On("GetTaskmanagersMetrics", mock.Anything).Return(taskmanagerMetricsInstances, nil) @@ -198,7 +198,7 @@ func TestScraperScrape(t *testing.T) { }, { desc: "API Call Failure on Subtasks", - setupMockClient: func(t *testing.T) client { + setupMockClient: func(*testing.T) client { mockClient := mocks.MockClient{} mockClient.On("GetJobmanagerMetrics", mock.Anything).Return(&jobmanagerMetrics, nil) mockClient.On("GetTaskmanagersMetrics", mock.Anything).Return(taskmanagerMetricsInstances, nil) @@ -227,7 +227,7 @@ func TestScraperScrape(t *testing.T) { }, { desc: "Successful Collection", - setupMockClient: func(t *testing.T) client { + setupMockClient: func(*testing.T) client { mockClient := mocks.MockClient{} // mock client calls diff --git a/receiver/gitproviderreceiver/internal/scraper/githubscraper/helpers_test.go b/receiver/gitproviderreceiver/internal/scraper/githubscraper/helpers_test.go index 9de036852df4..9edc81a0b64c 100644 --- a/receiver/gitproviderreceiver/internal/scraper/githubscraper/helpers_test.go +++ b/receiver/gitproviderreceiver/internal/scraper/githubscraper/helpers_test.go @@ -128,7 +128,7 @@ func MockServer(responses *responses) *http.ServeMux { } } }) - mux.HandleFunc(restEndpoint, func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc(restEndpoint, func(w http.ResponseWriter, _ *http.Request) { contribResp := &responses.contribResponse if contribResp.responseCode == http.StatusOK { contribs, err := json.Marshal(contribResp.contribs[contribResp.page]) diff --git a/receiver/googlecloudpubsubreceiver/internal/handler_test.go b/receiver/googlecloudpubsubreceiver/internal/handler_test.go index 9102de3b0aac..caf1d3b695ff 100644 --- a/receiver/googlecloudpubsubreceiver/internal/handler_test.go +++ b/receiver/googlecloudpubsubreceiver/internal/handler_test.go @@ -43,7 +43,7 @@ func TestCancelStream(t *testing.T) { assert.NoError(t, err) handler, err := NewHandler(context.Background(), zaptest.NewLogger(t), client, "client-id", "projects/my-project/subscriptions/otlp", - func(ctx context.Context, message *pubsubpb.ReceivedMessage) error { + func(context.Context, *pubsubpb.ReceivedMessage) error { return nil }) handler.ackBatchWait = 10 * time.Millisecond diff --git a/receiver/googlecloudspannerreceiver/internal/filter/itemcardinality_test.go b/receiver/googlecloudspannerreceiver/internal/filter/itemcardinality_test.go index cc6dd3f5246f..1a9858583d20 100644 --- a/receiver/googlecloudspannerreceiver/internal/filter/itemcardinality_test.go +++ b/receiver/googlecloudspannerreceiver/internal/filter/itemcardinality_test.go @@ -145,7 +145,7 @@ func TestItemCardinalityFilter_Filter(t *testing.T) { // Doing this to avoid of relying on timeouts and sleeps(avoid potential flaky tests) syncChannel := make(chan bool) - filterCasted.cache.SetExpirationCallback(func(key string, value any) { + filterCasted.cache.SetExpirationCallback(func(string, any) { if filterCasted.cache.Count() > 0 { // Waiting until cache is really empty - all items are expired return @@ -203,7 +203,7 @@ func TestItemCardinalityFilter_FilterItems(t *testing.T) { // Doing this to avoid of relying on timeouts and sleeps(avoid potential flaky tests) syncChannel := make(chan bool) - filterCasted.cache.SetExpirationCallback(func(key string, value any) { + filterCasted.cache.SetExpirationCallback(func(string, any) { if filterCasted.cache.Count() > 0 { // Waiting until cache is really empty - all items are expired return diff --git a/receiver/hostmetricsreceiver/integration_test.go b/receiver/hostmetricsreceiver/integration_test.go index c5d3200c77de..bfa4e4c33ad0 100644 --- a/receiver/hostmetricsreceiver/integration_test.go +++ b/receiver/hostmetricsreceiver/integration_test.go @@ -32,7 +32,7 @@ func Test_ProcessScrape(t *testing.T) { scraperinttest.NewIntegrationTest( NewFactory(), scraperinttest.WithCustomConfig( - func(t *testing.T, cfg component.Config, ci *scraperinttest.ContainerInfo) { + func(_ *testing.T, cfg component.Config, _ *scraperinttest.ContainerInfo) { rCfg := cfg.(*Config) rCfg.CollectionInterval = time.Second pCfg := (&processscraper.Factory{}).CreateDefaultConfig().(*processscraper.Config) @@ -62,7 +62,7 @@ func Test_ProcessScrapeWithCustomRootPath(t *testing.T) { scraperinttest.NewIntegrationTest( NewFactory(), scraperinttest.WithCustomConfig( - func(t *testing.T, cfg component.Config, ci *scraperinttest.ContainerInfo) { + func(_ *testing.T, cfg component.Config, _ *scraperinttest.ContainerInfo) { rCfg := cfg.(*Config) rCfg.CollectionInterval = time.Second pCfg := (&processscraper.Factory{}).CreateDefaultConfig().(*processscraper.Config) @@ -93,7 +93,7 @@ func Test_ProcessScrapeWithBadRootPathAndEnvVar(t *testing.T) { scraperinttest.NewIntegrationTest( NewFactory(), scraperinttest.WithCustomConfig( - func(t *testing.T, cfg component.Config, ci *scraperinttest.ContainerInfo) { + func(_ *testing.T, cfg component.Config, _ *scraperinttest.ContainerInfo) { rCfg := cfg.(*Config) rCfg.CollectionInterval = time.Second pCfg := (&processscraper.Factory{}).CreateDefaultConfig().(*processscraper.Config) diff --git a/receiver/hostmetricsreceiver/internal/scraper/diskscraper/disk_scraper_others_test.go b/receiver/hostmetricsreceiver/internal/scraper/diskscraper/disk_scraper_others_test.go index 8a1ef7a28491..bd3b2de71c44 100644 --- a/receiver/hostmetricsreceiver/internal/scraper/diskscraper/disk_scraper_others_test.go +++ b/receiver/hostmetricsreceiver/internal/scraper/diskscraper/disk_scraper_others_test.go @@ -28,7 +28,7 @@ func TestScrape_Others(t *testing.T) { testCases := []testCase{ { name: "Error", - ioCountersFunc: func(_ context.Context, names ...string) (map[string]disk.IOCountersStat, error) { + ioCountersFunc: func(context.Context, ...string) (map[string]disk.IOCountersStat, error) { return nil, errors.New("err1") }, expectedErr: "err1", diff --git a/receiver/hostmetricsreceiver/internal/scraper/filesystemscraper/filesystem_scraper_test.go b/receiver/hostmetricsreceiver/internal/scraper/filesystemscraper/filesystem_scraper_test.go index 247cc083d372..794f6f3b4f21 100644 --- a/receiver/hostmetricsreceiver/internal/scraper/filesystemscraper/filesystem_scraper_test.go +++ b/receiver/hostmetricsreceiver/internal/scraper/filesystemscraper/filesystem_scraper_test.go @@ -86,7 +86,7 @@ func TestScrape(t *testing.T) { } return paritions, err }, - usageFunc: func(_ context.Context, s string) (*disk.UsageStat, error) { + usageFunc: func(context.Context, string) (*disk.UsageStat, error) { return &disk.UsageStat{}, nil }, expectMetrics: true, @@ -115,12 +115,12 @@ func TestScrape(t *testing.T) { MountPoints: []string{"mount_point_b", "mount_point_c"}, }, }, - usageFunc: func(_ context.Context, s string) (*disk.UsageStat, error) { + usageFunc: func(context.Context, string) (*disk.UsageStat, error) { return &disk.UsageStat{ Fstype: "fs_type_a", }, nil }, - partitionsFunc: func(_ context.Context, b bool) ([]disk.PartitionStat, error) { + partitionsFunc: func(context.Context, bool) ([]disk.PartitionStat, error) { return []disk.PartitionStat{ { Device: "device_a", @@ -175,7 +175,7 @@ func TestScrape(t *testing.T) { Fstype: "fs_type_a", }, nil }, - partitionsFunc: func(_ context.Context, b bool) ([]disk.PartitionStat, error) { + partitionsFunc: func(context.Context, bool) ([]disk.PartitionStat, error) { return []disk.PartitionStat{ { Device: "device_a", @@ -265,12 +265,12 @@ func TestScrape(t *testing.T) { FSTypes: []string{"fs_type_b"}, }, }, - usageFunc: func(_ context.Context, s string) (*disk.UsageStat, error) { + usageFunc: func(context.Context, string) (*disk.UsageStat, error) { return &disk.UsageStat{ Fstype: "fs_type_a", }, nil }, - partitionsFunc: func(_ context.Context, b bool) ([]disk.PartitionStat, error) { + partitionsFunc: func(context.Context, bool) ([]disk.PartitionStat, error) { return []disk.PartitionStat{ { Device: "device_a", diff --git a/receiver/hostmetricsreceiver/internal/scraper/networkscraper/network_scraper_test.go b/receiver/hostmetricsreceiver/internal/scraper/networkscraper/network_scraper_test.go index b033fc1b6064..36fed0a11a07 100644 --- a/receiver/hostmetricsreceiver/internal/scraper/networkscraper/network_scraper_test.go +++ b/receiver/hostmetricsreceiver/internal/scraper/networkscraper/network_scraper_test.go @@ -121,7 +121,7 @@ func TestScrape(t *testing.T) { config: &Config{ MetricsBuilderConfig: metadata.DefaultMetricsBuilderConfig(), // conntrack metrics are disabled by default }, - conntrackFunc: func(ctx context.Context) ([]net.FilterStat, error) { return nil, errors.New("conntrack failed") }, + conntrackFunc: func(context.Context) ([]net.FilterStat, error) { return nil, errors.New("conntrack failed") }, expectConntrakMetrics: true, expectConnectionsMetric: true, }, @@ -132,7 +132,7 @@ func TestScrape(t *testing.T) { cfg.MetricsBuilderConfig.Metrics.SystemNetworkConnections.Enabled = false return &cfg }(), - connectionsFunc: func(ctx context.Context, s string) ([]net.ConnectionStat, error) { + connectionsFunc: func(context.Context, string) ([]net.ConnectionStat, error) { panic("should not be called") }, expectConntrakMetrics: true, diff --git a/receiver/hostmetricsreceiver/internal/scraper/processesscraper/processes_scraper_test.go b/receiver/hostmetricsreceiver/internal/scraper/processesscraper/processes_scraper_test.go index cf37e89b147f..39e5103e7d63 100644 --- a/receiver/hostmetricsreceiver/internal/scraper/processesscraper/processes_scraper_test.go +++ b/receiver/hostmetricsreceiver/internal/scraper/processesscraper/processes_scraper_test.go @@ -43,7 +43,7 @@ func TestScrape(t *testing.T) { validate: validateRealData, }, { name: "FakeData", - getMiscStats: func(ctx context.Context) (*load.MiscStat, error) { return &fakeData, nil }, + getMiscStats: func(context.Context) (*load.MiscStat, error) { return &fakeData, nil }, getProcesses: func() ([]proc, error) { return fakeProcessesData, nil }, validate: validateFakeData, }, { diff --git a/receiver/hostmetricsreceiver/internal/scraper/processscraper/process_scraper_test.go b/receiver/hostmetricsreceiver/internal/scraper/processscraper/process_scraper_test.go index 095410a0cc2e..118899562c80 100644 --- a/receiver/hostmetricsreceiver/internal/scraper/processscraper/process_scraper_test.go +++ b/receiver/hostmetricsreceiver/internal/scraper/processscraper/process_scraper_test.go @@ -68,7 +68,7 @@ func TestScrape(t *testing.T) { }, { name: "Enable memory utilization", - mutateMetricsConfig: func(t *testing.T, ms *metadata.MetricsConfig) { + mutateMetricsConfig: func(_ *testing.T, ms *metadata.MetricsConfig) { ms.ProcessMemoryUtilization.Enabled = true }, }, @@ -92,7 +92,7 @@ func TestScrape(t *testing.T) { if test.mutateScraper != nil { test.mutateScraper(scraper) } - scraper.getProcessCreateTime = func(p processHandle, ctx context.Context) (int64, error) { return createTime, nil } + scraper.getProcessCreateTime = func(processHandle, context.Context) (int64, error) { return createTime, nil } require.NoError(t, err, "Failed to create process scraper: %v", err) err = scraper.start(context.Background(), componenttest.NewNopHost()) require.NoError(t, err, "Failed to initialize process scraper: %v", err) diff --git a/receiver/httpcheckreceiver/scraper_test.go b/receiver/httpcheckreceiver/scraper_test.go index 25008541d6aa..ef0244b98c55 100644 --- a/receiver/httpcheckreceiver/scraper_test.go +++ b/receiver/httpcheckreceiver/scraper_test.go @@ -22,7 +22,7 @@ import ( ) func newMockServer(t *testing.T, responseCode int) *httptest.Server { - return httptest.NewServer(http.HandlerFunc(func(rw http.ResponseWriter, req *http.Request) { + return httptest.NewServer(http.HandlerFunc(func(rw http.ResponseWriter, _ *http.Request) { rw.WriteHeader(responseCode) // This could be expanded if the checks for the server include // parsing the response content diff --git a/receiver/jmxreceiver/internal/subprocess/integration_test.go b/receiver/jmxreceiver/internal/subprocess/integration_test.go index 899e38e90fe8..5125273e224d 100644 --- a/receiver/jmxreceiver/internal/subprocess/integration_test.go +++ b/receiver/jmxreceiver/internal/subprocess/integration_test.go @@ -232,7 +232,7 @@ func (suite *SubprocessIntegrationSuite) TestSendingStdinFails() { subprocess := NewSubprocess(&Config{ExecutablePath: "echo", Args: []string{"finished"}}, logger) intentionalError := fmt.Errorf("intentional failure") - subprocess.sendToStdIn = func(contents string, writer io.Writer) error { + subprocess.sendToStdIn = func(string, io.Writer) error { return intentionalError } diff --git a/receiver/jmxreceiver/receiver_test.go b/receiver/jmxreceiver/receiver_test.go index e00d2a1f734f..9540fc088eb1 100644 --- a/receiver/jmxreceiver/receiver_test.go +++ b/receiver/jmxreceiver/receiver_test.go @@ -145,7 +145,7 @@ otel.resource.attributes = abc=123,one=two`, } for _, test := range tests { - t.Run(test.name, func(tt *testing.T) { + t.Run(test.name, func(*testing.T) { params := receivertest.NewNopCreateSettings() receiver := newJMXMetricReceiver(params, test.config, consumertest.NewNop()) jmxConfig, err := receiver.buildJMXMetricGathererConfig() @@ -178,7 +178,7 @@ func TestBuildOTLPReceiverInvalidEndpoints(t *testing.T) { }, } for _, test := range tests { - t.Run(test.name, func(tt *testing.T) { + t.Run(test.name, func(*testing.T) { params := receivertest.NewNopCreateSettings() jmxReceiver := newJMXMetricReceiver(params, test.config, consumertest.NewNop()) otlpReceiver, err := jmxReceiver.buildOTLPReceiver() diff --git a/receiver/k8seventsreceiver/factory_test.go b/receiver/k8seventsreceiver/factory_test.go index 7192a760b935..8cf5dca06623 100644 --- a/receiver/k8seventsreceiver/factory_test.go +++ b/receiver/k8seventsreceiver/factory_test.go @@ -48,7 +48,7 @@ func TestCreateReceiver(t *testing.T) { assert.Error(t, err) // Override for test. - rCfg.makeClient = func(apiConf k8sconfig.APIConfig) (k8s.Interface, error) { + rCfg.makeClient = func(k8sconfig.APIConfig) (k8s.Interface, error) { return fake.NewSimpleClientset(), nil } r, err = createLogsReceiver( diff --git a/receiver/k8seventsreceiver/receiver_test.go b/receiver/k8seventsreceiver/receiver_test.go index 49cff154707f..4d9cc4d26519 100644 --- a/receiver/k8seventsreceiver/receiver_test.go +++ b/receiver/k8seventsreceiver/receiver_test.go @@ -24,7 +24,7 @@ import ( func TestNewReceiver(t *testing.T) { rCfg := createDefaultConfig().(*Config) - rCfg.makeClient = func(apiConf k8sconfig.APIConfig) (k8s.Interface, error) { + rCfg.makeClient = func(k8sconfig.APIConfig) (k8s.Interface, error) { return fake.NewSimpleClientset(), nil } r, err := newReceiver( diff --git a/receiver/kafkametricsreceiver/broker_scraper_test.go b/receiver/kafkametricsreceiver/broker_scraper_test.go index 4c386e179997..0a50edbe7701 100644 --- a/receiver/kafkametricsreceiver/broker_scraper_test.go +++ b/receiver/kafkametricsreceiver/broker_scraper_test.go @@ -70,7 +70,7 @@ func TestBrokerScraperStart(t *testing.T) { } func TestBrokerScraper_scrape_handles_client_error(t *testing.T) { - newSaramaClient = func(addrs []string, conf *sarama.Config) (sarama.Client, error) { + newSaramaClient = func([]string, *sarama.Config) (sarama.Client, error) { return nil, fmt.Errorf("new client failed") } sc := sarama.NewConfig() @@ -82,7 +82,7 @@ func TestBrokerScraper_scrape_handles_client_error(t *testing.T) { } func TestBrokerScraper_shutdown_handles_nil_client(t *testing.T) { - newSaramaClient = func(addrs []string, conf *sarama.Config) (sarama.Client, error) { + newSaramaClient = func([]string, *sarama.Config) (sarama.Client, error) { return nil, fmt.Errorf("new client failed") } sc := sarama.NewConfig() diff --git a/receiver/kafkametricsreceiver/consumer_scraper.go b/receiver/kafkametricsreceiver/consumer_scraper.go index 034db3c82304..2b9c0311d457 100644 --- a/receiver/kafkametricsreceiver/consumer_scraper.go +++ b/receiver/kafkametricsreceiver/consumer_scraper.go @@ -69,10 +69,10 @@ func (s *consumerScraper) scrape(context.Context) (pmetric.Metrics, error) { return pmetric.Metrics{}, listErr } - var matchedGrpIds []string + var matchedGrpIDs []string for grpID := range cgs { if s.groupFilter.MatchString(grpID) { - matchedGrpIds = append(matchedGrpIds, grpID) + matchedGrpIDs = append(matchedGrpIDs, grpID) } } @@ -110,7 +110,7 @@ func (s *consumerScraper) scrape(context.Context) (pmetric.Metrics, error) { topicPartitionOffset[topic][p] = offset } } - consumerGroups, listErr := s.clusterAdmin.DescribeConsumerGroups(matchedGrpIds) + consumerGroups, listErr := s.clusterAdmin.DescribeConsumerGroups(matchedGrpIDs) if listErr != nil { return pmetric.Metrics{}, listErr } diff --git a/receiver/kafkametricsreceiver/consumer_scraper_test.go b/receiver/kafkametricsreceiver/consumer_scraper_test.go index 5cf9f1e71e01..67cca9832a14 100644 --- a/receiver/kafkametricsreceiver/consumer_scraper_test.go +++ b/receiver/kafkametricsreceiver/consumer_scraper_test.go @@ -57,7 +57,7 @@ func TestConsumerScraper_createConsumerScraper(t *testing.T) { } func TestConsumerScraper_scrape_handles_client_error(t *testing.T) { - newSaramaClient = func(addrs []string, conf *sarama.Config) (sarama.Client, error) { + newSaramaClient = func([]string, *sarama.Config) (sarama.Client, error) { return nil, fmt.Errorf("new client failed") } sc := sarama.NewConfig() @@ -69,7 +69,7 @@ func TestConsumerScraper_scrape_handles_client_error(t *testing.T) { } func TestConsumerScraper_scrape_handles_nil_client(t *testing.T) { - newSaramaClient = func(addrs []string, conf *sarama.Config) (sarama.Client, error) { + newSaramaClient = func([]string, *sarama.Config) (sarama.Client, error) { return nil, fmt.Errorf("new client failed") } sc := sarama.NewConfig() @@ -81,13 +81,13 @@ func TestConsumerScraper_scrape_handles_nil_client(t *testing.T) { } func TestConsumerScraper_scrape_handles_clusterAdmin_error(t *testing.T) { - newSaramaClient = func(addrs []string, conf *sarama.Config) (sarama.Client, error) { + newSaramaClient = func([]string, *sarama.Config) (sarama.Client, error) { client := newMockClient() client.Mock. On("Close").Return(nil) return client, nil } - newClusterAdmin = func(addrs []string, conf *sarama.Config) (sarama.ClusterAdmin, error) { + newClusterAdmin = func([]string, *sarama.Config) (sarama.ClusterAdmin, error) { return nil, fmt.Errorf("new cluster admin failed") } sc := sarama.NewConfig() diff --git a/receiver/kafkametricsreceiver/factory_test.go b/receiver/kafkametricsreceiver/factory_test.go index 04331d430823..6b2a7d991a5e 100644 --- a/receiver/kafkametricsreceiver/factory_test.go +++ b/receiver/kafkametricsreceiver/factory_test.go @@ -34,7 +34,7 @@ func TestCreateMetricsReceiver_errors(t *testing.T) { func TestCreateMetricsReceiver(t *testing.T) { prev := newMetricsReceiver - newMetricsReceiver = func(ctx context.Context, config Config, params receiver.CreateSettings, consumer consumer.Metrics) (receiver.Metrics, error) { + newMetricsReceiver = func(context.Context, Config, receiver.CreateSettings, consumer.Metrics) (receiver.Metrics, error) { return nil, nil } factory := NewFactory() diff --git a/receiver/kafkametricsreceiver/receiver_test.go b/receiver/kafkametricsreceiver/receiver_test.go index 0e50e97d9022..5a8ac97222c6 100644 --- a/receiver/kafkametricsreceiver/receiver_test.go +++ b/receiver/kafkametricsreceiver/receiver_test.go @@ -62,7 +62,7 @@ func TestNewReceiver(t *testing.T) { c := createDefaultConfig().(*Config) c.Scrapers = []string{"brokers"} mockScraper := func(context.Context, Config, *sarama.Config, receiver.CreateSettings) (scraperhelper.Scraper, error) { - return scraperhelper.NewScraper("brokers", func(ctx context.Context) (pmetric.Metrics, error) { + return scraperhelper.NewScraper("brokers", func(context.Context) (pmetric.Metrics, error) { return pmetric.Metrics{}, nil }) } diff --git a/receiver/kafkametricsreceiver/topic_scraper_test.go b/receiver/kafkametricsreceiver/topic_scraper_test.go index 59098d9cde1c..1c545d493e91 100644 --- a/receiver/kafkametricsreceiver/topic_scraper_test.go +++ b/receiver/kafkametricsreceiver/topic_scraper_test.go @@ -60,7 +60,7 @@ func TestTopicScraper_createsScraper(t *testing.T) { } func TestTopicScraper_ScrapeHandlesError(t *testing.T) { - newSaramaClient = func(addrs []string, conf *sarama.Config) (sarama.Client, error) { + newSaramaClient = func([]string, *sarama.Config) (sarama.Client, error) { return nil, fmt.Errorf("no scraper here") } sc := sarama.NewConfig() @@ -72,7 +72,7 @@ func TestTopicScraper_ScrapeHandlesError(t *testing.T) { } func TestTopicScraper_ShutdownHandlesNilClient(t *testing.T) { - newSaramaClient = func(addrs []string, conf *sarama.Config) (sarama.Client, error) { + newSaramaClient = func([]string, *sarama.Config) (sarama.Client, error) { return nil, fmt.Errorf("no scraper here") } sc := sarama.NewConfig() diff --git a/receiver/kubeletstatsreceiver/internal/kubelet/accumulator_test.go b/receiver/kubeletstatsreceiver/internal/kubelet/accumulator_test.go index fd18bfd27096..536f13161ab5 100644 --- a/receiver/kubeletstatsreceiver/internal/kubelet/accumulator_test.go +++ b/receiver/kubeletstatsreceiver/internal/kubelet/accumulator_test.go @@ -166,7 +166,7 @@ func TestMetadataErrorCases(t *testing.T) { }, }, }, nil), - detailedPVCLabelsSetterOverride: func(rb *metadata.ResourceBuilder, volCacheID, volumeClaim, namespace string) error { + detailedPVCLabelsSetterOverride: func(*metadata.ResourceBuilder, string, string, string) error { // Mock failure cases. return errors.New("") }, diff --git a/receiver/kubeletstatsreceiver/internal/kubelet/metadata_test.go b/receiver/kubeletstatsreceiver/internal/kubelet/metadata_test.go index dfb666c1e703..be2e0329ca22 100644 --- a/receiver/kubeletstatsreceiver/internal/kubelet/metadata_test.go +++ b/receiver/kubeletstatsreceiver/internal/kubelet/metadata_test.go @@ -376,7 +376,7 @@ func TestSetExtraLabelsForVolumeTypes(t *testing.T) { }, }, }, - }, func(rb *metadata.ResourceBuilder, volCacheID, volumeClaim, namespace string) error { + }, func(*metadata.ResourceBuilder, string, string, string) error { return nil }) rb := metadata.NewResourceBuilder(metadata.DefaultResourceAttributesConfig()) diff --git a/receiver/kubeletstatsreceiver/internal/kubelet/volume_test.go b/receiver/kubeletstatsreceiver/internal/kubelet/volume_test.go index 55feefa5c238..958617615bbe 100644 --- a/receiver/kubeletstatsreceiver/internal/kubelet/volume_test.go +++ b/receiver/kubeletstatsreceiver/internal/kubelet/volume_test.go @@ -40,7 +40,7 @@ func TestDetailedPVCLabels(t *testing.T) { }, }, pod: pod{uid: "uid-1234", name: "pod-name", namespace: "pod-namespace"}, - detailedPVCLabelsSetterOverride: func(rb *metadata.ResourceBuilder, volCacheID, volumeClaim, namespace string) error { + detailedPVCLabelsSetterOverride: func(rb *metadata.ResourceBuilder, _, _, _ string) error { SetPersistentVolumeLabels(rb, v1.PersistentVolumeSource{ AWSElasticBlockStore: &v1.AWSElasticBlockStoreVolumeSource{ VolumeID: "volume_id", @@ -71,7 +71,7 @@ func TestDetailedPVCLabels(t *testing.T) { }, }, pod: pod{uid: "uid-1234", name: "pod-name", namespace: "pod-namespace"}, - detailedPVCLabelsSetterOverride: func(rb *metadata.ResourceBuilder, volCacheID, volumeClaim, namespace string) error { + detailedPVCLabelsSetterOverride: func(rb *metadata.ResourceBuilder, _, _, _ string) error { SetPersistentVolumeLabels(rb, v1.PersistentVolumeSource{ GCEPersistentDisk: &v1.GCEPersistentDiskVolumeSource{ PDName: "pd_name", @@ -102,7 +102,7 @@ func TestDetailedPVCLabels(t *testing.T) { }, }, pod: pod{uid: "uid-1234", name: "pod-name", namespace: "pod-namespace"}, - detailedPVCLabelsSetterOverride: func(rb *metadata.ResourceBuilder, volCacheID, volumeClaim, namespace string) error { + detailedPVCLabelsSetterOverride: func(rb *metadata.ResourceBuilder, _, _, _ string) error { SetPersistentVolumeLabels(rb, v1.PersistentVolumeSource{ Glusterfs: &v1.GlusterfsPersistentVolumeSource{ EndpointsName: "endpoints_name", @@ -131,7 +131,7 @@ func TestDetailedPVCLabels(t *testing.T) { }, }, pod: pod{uid: "uid-1234", name: "pod-name", namespace: "pod-namespace"}, - detailedPVCLabelsSetterOverride: func(rb *metadata.ResourceBuilder, volCacheID, volumeClaim, namespace string) error { + detailedPVCLabelsSetterOverride: func(rb *metadata.ResourceBuilder, _, _, _ string) error { SetPersistentVolumeLabels(rb, v1.PersistentVolumeSource{ Local: &v1.LocalVolumeSource{ Path: "path", diff --git a/receiver/memcachedreceiver/scraper_test.go b/receiver/memcachedreceiver/scraper_test.go index 4f3bf667da44..1903ddec0e22 100644 --- a/receiver/memcachedreceiver/scraper_test.go +++ b/receiver/memcachedreceiver/scraper_test.go @@ -20,7 +20,7 @@ func TestScraper(t *testing.T) { f := NewFactory() cfg := f.CreateDefaultConfig().(*Config) scraper := newMemcachedScraper(receivertest.NewNopCreateSettings(), cfg) - scraper.newClient = func(endpoint string, timeout time.Duration) (client, error) { + scraper.newClient = func(string, time.Duration) (client, error) { return &fakeClient{}, nil } diff --git a/receiver/mongodbreceiver/scraper_test.go b/receiver/mongodbreceiver/scraper_test.go index bcfa156fd2f6..4ca8df8c7e79 100644 --- a/receiver/mongodbreceiver/scraper_test.go +++ b/receiver/mongodbreceiver/scraper_test.go @@ -128,10 +128,10 @@ func TestScraperScrape(t *testing.T) { { desc: "Nil client", partialErr: false, - setupMockClient: func(t *testing.T) *fakeClient { + setupMockClient: func(*testing.T) *fakeClient { return nil }, - expectedMetricGen: func(t *testing.T) pmetric.Metrics { + expectedMetricGen: func(*testing.T) pmetric.Metrics { return pmetric.NewMetrics() }, expectedErr: errors.New("no client was initialized before calling scrape"), @@ -147,7 +147,7 @@ func TestScraperScrape(t *testing.T) { fc.On("ListDatabaseNames", mock.Anything, mock.Anything, mock.Anything).Return([]string{}, errors.New("some database names error")) return fc }, - expectedMetricGen: func(t *testing.T) pmetric.Metrics { + expectedMetricGen: func(*testing.T) pmetric.Metrics { return pmetric.NewMetrics() }, expectedErr: errors.New("failed to fetch database names: some database names error"), diff --git a/receiver/mysqlreceiver/client.go b/receiver/mysqlreceiver/client.go index df3de22bb0b8..60a838a0458f 100644 --- a/receiver/mysqlreceiver/client.go +++ b/receiver/mysqlreceiver/client.go @@ -137,7 +137,7 @@ type ReplicaStatusStats struct { lastIOError string lastSQLErrno int64 lastSQLError string - replicateIgnoreServerIds string + replicateIgnoreServerIDs string sourceServerID int64 sourceUUID string sourceInfoFile string @@ -462,7 +462,7 @@ func (c *mySQLClient) getReplicaStatusStats() ([]ReplicaStatusStats, error) { case "last_sql_error": dest = append(dest, &s.lastSQLError) case "replicate_ignore_server_ids": - dest = append(dest, &s.replicateIgnoreServerIds) + dest = append(dest, &s.replicateIgnoreServerIDs) case "source_server_id": dest = append(dest, &s.sourceServerID) case "source_uuid": diff --git a/receiver/mysqlreceiver/scraper_test.go b/receiver/mysqlreceiver/scraper_test.go index 652e47ed85a1..93a661ecfab0 100644 --- a/receiver/mysqlreceiver/scraper_test.go +++ b/receiver/mysqlreceiver/scraper_test.go @@ -349,7 +349,7 @@ func (c *mockClient) getReplicaStatusStats() ([]ReplicaStatusStats, error) { s.lastIOError = text[35] s.lastSQLErrno, _ = parseInt(text[36]) s.lastSQLError = text[37] - s.replicateIgnoreServerIds = text[38] + s.replicateIgnoreServerIDs = text[38] s.sourceServerID, _ = parseInt(text[39]) s.sourceUUID = text[40] s.sourceInfoFile = text[41]