From 0204d957e596c17b17533cd4408fc7f614904750 Mon Sep 17 00:00:00 2001 From: Matthieu MOREL Date: Thu, 31 Oct 2024 20:15:54 +0100 Subject: [PATCH] [chore]: enable whitespace linter (#11579) #### Description [whitespace](https://golangci-lint.run/usage/linters/#whitespace) is a linter that checks for unnecessary newlines at the start and end of functions. Signed-off-by: Matthieu MOREL --- .golangci.yml | 1 + cmd/mdatagen/internal/embedded_templates_test.go | 1 - cmd/mdatagen/internal/samplereceiver/metrics_test.go | 1 - component/componentstatus/instance_test.go | 1 - component/componenttest/configtest.go | 2 -- config/configcompression/compressiontype.go | 1 - config/configgrpc/configgrpc_test.go | 1 - config/confighttp/compressor_test.go | 1 - config/confighttp/confighttp_test.go | 4 ---- config/configretry/backoff.go | 1 - config/configtls/configtls_test.go | 5 ----- config/internal/warning_test.go | 1 - .../internal/configurablehttpprovider/provider.go | 1 - confmap/provider_test.go | 1 - exporter/debugexporter/config_test.go | 1 - .../debugexporter/internal/otlptext/databuffer.go | 1 - .../debugexporter/internal/otlptext/traces_test.go | 1 - .../exporterhelperprofiles/profiles_batch_test.go | 1 - exporter/exporterhelper/internal/queue_sender_test.go | 1 - exporter/exporterhelper/logs_batch_test.go | 1 - exporter/exportertest/mock_consumer_test.go | 11 ----------- exporter/internal/queue/default_batcher.go | 1 - exporter/internal/queue/persistent_queue.go | 1 - exporter/internal/queue/persistent_queue_test.go | 1 - exporter/otlpexporter/config_test.go | 1 - extension/auth/client_test.go | 1 - extension/zpagesextension/zpagesextension.go | 1 - otelcol/command_components.go | 1 - otelcol/unmarshaler.go | 1 - pdata/pcommon/value_test.go | 1 - pdata/plog/pb_test.go | 1 - pdata/pprofile/pprofileotlp/response.go | 1 - pdata/ptrace/ptraceotlp/response.go | 1 - processor/batchprocessor/config_test.go | 1 - receiver/otlpreceiver/config_test.go | 1 - receiver/otlpreceiver/fuzz_test.go | 1 - receiver/receiverprofiles/profiles.go | 1 - receiver/receivertest/contract_checker_test.go | 3 --- receiver/scraperhelper/scrapercontroller.go | 1 - service/extensions/extensions_test.go | 1 - service/internal/graph/graph_test.go | 1 - service/internal/graph/lifecycle_test.go | 2 -- service/internal/resource/config_test.go | 1 - service/internal/status/status_test.go | 1 - service/telemetry/logger.go | 1 - service/telemetry/metrics.go | 1 - service/telemetry/metrics_test.go | 1 - 47 files changed, 1 insertion(+), 67 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index da3e07f5626..7865174d156 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -144,6 +144,7 @@ linters: - unused - unparam - usestdlibvars + - whitespace issues: # Excluding configuration per-path, per-linter, per-text and per-source diff --git a/cmd/mdatagen/internal/embedded_templates_test.go b/cmd/mdatagen/internal/embedded_templates_test.go index 97bc268edb3..5ffdc562c13 100644 --- a/cmd/mdatagen/internal/embedded_templates_test.go +++ b/cmd/mdatagen/internal/embedded_templates_test.go @@ -48,5 +48,4 @@ func TestEnsureTemplatesLoaded(t *testing.T) { return nil })) assert.Equal(t, len(templateFiles), count, "Must match the expected number of calls") - } diff --git a/cmd/mdatagen/internal/samplereceiver/metrics_test.go b/cmd/mdatagen/internal/samplereceiver/metrics_test.go index fe6438bb304..f055254ac9a 100644 --- a/cmd/mdatagen/internal/samplereceiver/metrics_test.go +++ b/cmd/mdatagen/internal/samplereceiver/metrics_test.go @@ -104,5 +104,4 @@ func TestComponentTelemetry(t *testing.T) { }, }) require.NoError(t, tt.Shutdown(context.Background())) - } diff --git a/component/componentstatus/instance_test.go b/component/componentstatus/instance_test.go index dc722830748..6d734cba33d 100644 --- a/component/componentstatus/instance_test.go +++ b/component/componentstatus/instance_test.go @@ -92,5 +92,4 @@ func TestAllPipelineIDs(t *testing.T) { return false }) assert.Equal(t, 1, count) - } diff --git a/component/componenttest/configtest.go b/component/componenttest/configtest.go index 3750dfd0295..8d1f1d157da 100644 --- a/component/componenttest/configtest.go +++ b/component/componenttest/configtest.go @@ -65,10 +65,8 @@ func validateConfigDataType(t reflect.Type) error { // checkStructFieldTags inspects the tags of a struct field. func checkStructFieldTags(f reflect.StructField) error { - tagValue := f.Tag.Get("mapstructure") if tagValue == "" { - // Ignore special types. switch f.Type.Kind() { case reflect.Interface, reflect.Chan, reflect.Func, reflect.Uintptr, reflect.UnsafePointer: diff --git a/config/configcompression/compressiontype.go b/config/configcompression/compressiontype.go index fd4fd87cf42..f5b47f9caa2 100644 --- a/config/configcompression/compressiontype.go +++ b/config/configcompression/compressiontype.go @@ -39,5 +39,4 @@ func (ct *Type) UnmarshalText(in []byte) error { return nil } return fmt.Errorf("unsupported compression type %q", typ) - } diff --git a/config/configgrpc/configgrpc_test.go b/config/configgrpc/configgrpc_test.go index 6f7398ceac6..561df1f1dfe 100644 --- a/config/configgrpc/configgrpc_test.go +++ b/config/configgrpc/configgrpc_test.go @@ -560,7 +560,6 @@ func TestGRPCServerWarning(t *testing.T) { require.Len(t, observed.FilterLevelExact(zap.WarnLevel).All(), test.len) }) } - } func TestGRPCServerSettingsError(t *testing.T) { diff --git a/config/confighttp/compressor_test.go b/config/confighttp/compressor_test.go index 29efe4190d0..65e444578b4 100644 --- a/config/confighttp/compressor_test.go +++ b/config/confighttp/compressor_test.go @@ -49,7 +49,6 @@ func BenchmarkCompression(b *testing.B) { b.Run(fmt.Sprint(benchmark.name), func(b *testing.B) { benchmark.function(b, benchmark.codec, &buffer, payload) }) - } } diff --git a/config/confighttp/confighttp_test.go b/config/confighttp/confighttp_test.go index c03b7aa89ed..d9de4493e0b 100644 --- a/config/confighttp/confighttp_test.go +++ b/config/confighttp/confighttp_test.go @@ -220,7 +220,6 @@ func TestPartialHTTPClientSettings(t *testing.T) { assert.EqualValues(t, 0, transport.MaxConnsPerHost) assert.EqualValues(t, 90*time.Second, transport.IdleConnTimeout) assert.False(t, transport.DisableKeepAlives) - }) } } @@ -554,7 +553,6 @@ func TestHTTPServerWarning(t *testing.T) { require.Len(t, observed.FilterLevelExact(zap.WarnLevel).All(), tt.len) }) } - } func TestHttpReception(t *testing.T) { @@ -1279,7 +1277,6 @@ func TestServerWithDecoder(t *testing.T) { srv.Handler.ServeHTTP(response, req) // verify assert.Equal(t, http.StatusOK, response.Result().StatusCode) - } func TestServerWithDecompression(t *testing.T) { @@ -1497,7 +1494,6 @@ func BenchmarkHttpRequest(b *testing.B) { if !bb.clientPerThread { c, err = hcs.ToClient(context.Background(), componenttest.NewNopHost(), nilProvidersSettings) require.NoError(b, err) - } b.RunParallel(func(pb *testing.PB) { if c == nil { diff --git a/config/configretry/backoff.go b/config/configretry/backoff.go index 1fc3f8c5852..476c350b05f 100644 --- a/config/configretry/backoff.go +++ b/config/configretry/backoff.go @@ -68,7 +68,6 @@ func (bs *BackOffConfig) Validate() error { if bs.MaxElapsedTime < bs.MaxInterval { return errors.New("'max_elapsed_time' must not be less than 'max_interval'") } - } return nil } diff --git a/config/configtls/configtls_test.go b/config/configtls/configtls_test.go index 53876b09b11..4c2cd6a7c76 100644 --- a/config/configtls/configtls_test.go +++ b/config/configtls/configtls_test.go @@ -327,7 +327,6 @@ func TestLoadTLSServerConfig(t *testing.T) { } func TestLoadTLSServerConfigReload(t *testing.T) { - tmpCaPath := createTempClientCaFile(t) overwriteClientCA(t, tmpCaPath, "ca-1.crt") @@ -358,7 +357,6 @@ func TestLoadTLSServerConfigReload(t *testing.T) { } func TestLoadTLSServerConfigFailingReload(t *testing.T) { - tmpCaPath := createTempClientCaFile(t) overwriteClientCA(t, tmpCaPath, "ca-1.crt") @@ -389,7 +387,6 @@ func TestLoadTLSServerConfigFailingReload(t *testing.T) { } func TestLoadTLSServerConfigFailingInitialLoad(t *testing.T) { - tmpCaPath := createTempClientCaFile(t) overwriteClientCA(t, tmpCaPath, "testCA-bad.txt") @@ -405,7 +402,6 @@ func TestLoadTLSServerConfigFailingInitialLoad(t *testing.T) { } func TestLoadTLSServerConfigWrongPath(t *testing.T) { - tmpCaPath := createTempClientCaFile(t) tlsSetting := ServerConfig{ @@ -419,7 +415,6 @@ func TestLoadTLSServerConfigWrongPath(t *testing.T) { } func TestLoadTLSServerConfigFailing(t *testing.T) { - tmpCaPath := createTempClientCaFile(t) overwriteClientCA(t, tmpCaPath, "ca-1.crt") diff --git a/config/internal/warning_test.go b/config/internal/warning_test.go index 427ba792285..3e8a2f01387 100644 --- a/config/internal/warning_test.go +++ b/config/internal/warning_test.go @@ -54,5 +54,4 @@ func TestShouldWarn(t *testing.T) { assert.Equal(t, shouldWarn(test.endpoint), test.warn) }) } - } diff --git a/confmap/provider/internal/configurablehttpprovider/provider.go b/confmap/provider/internal/configurablehttpprovider/provider.go index 2d968e3bafe..87a37fbc907 100644 --- a/confmap/provider/internal/configurablehttpprovider/provider.go +++ b/confmap/provider/internal/configurablehttpprovider/provider.go @@ -80,7 +80,6 @@ func (fmp *provider) createClient() (*http.Client, error) { } func (fmp *provider) Retrieve(_ context.Context, uri string, _ confmap.WatcherFunc) (*confmap.Retrieved, error) { - if !strings.HasPrefix(uri, string(fmp.scheme)+":") { return nil, fmt.Errorf("%q uri is not supported by %q provider", uri, string(fmp.scheme)) } diff --git a/confmap/provider_test.go b/confmap/provider_test.go index 3877222865c..68d3e33765b 100644 --- a/confmap/provider_test.go +++ b/confmap/provider_test.go @@ -157,5 +157,4 @@ func TestNewRetrievedFromYAMLString(t *testing.T) { } }) } - } diff --git a/exporter/debugexporter/config_test.go b/exporter/debugexporter/config_test.go index ef204196e61..e35419d517f 100644 --- a/exporter/debugexporter/config_test.go +++ b/exporter/debugexporter/config_test.go @@ -79,7 +79,6 @@ func Test_UnmarshalMarshalled(t *testing.T) { }, } { t.Run(name, func(t *testing.T) { - conf := confmap.New() err := conf.Marshal(tc.inCfg) require.NoError(t, err) diff --git a/exporter/debugexporter/internal/otlptext/databuffer.go b/exporter/debugexporter/internal/otlptext/databuffer.go index 4e73794da7a..37ca74449c2 100644 --- a/exporter/debugexporter/internal/otlptext/databuffer.go +++ b/exporter/debugexporter/internal/otlptext/databuffer.go @@ -350,7 +350,6 @@ func (b *dataBuffer) logProfileMappings(ms pprofile.MappingSlice) { b.logEntry(" Has filenames: %t", mapping.HasFilenames()) b.logEntry(" Has line numbers: %t", mapping.HasLineNumbers()) b.logEntry(" Has inline frames: %t", mapping.HasInlineFrames()) - } } diff --git a/exporter/debugexporter/internal/otlptext/traces_test.go b/exporter/debugexporter/internal/otlptext/traces_test.go index 454a2989f0f..c99b0597056 100644 --- a/exporter/debugexporter/internal/otlptext/traces_test.go +++ b/exporter/debugexporter/internal/otlptext/traces_test.go @@ -17,7 +17,6 @@ import ( ) func TestTracesText(t *testing.T) { - tests := []struct { name string in ptrace.Traces diff --git a/exporter/exporterhelper/exporterhelperprofiles/profiles_batch_test.go b/exporter/exporterhelper/exporterhelperprofiles/profiles_batch_test.go index 9674e2d3fd4..288b4c35790 100644 --- a/exporter/exporterhelper/exporterhelperprofiles/profiles_batch_test.go +++ b/exporter/exporterhelper/exporterhelperprofiles/profiles_batch_test.go @@ -124,7 +124,6 @@ func TestMergeSplitProfiles(t *testing.T) { assert.Equal(t, tt.expected[i], r.(*profilesRequest)) } }) - } } diff --git a/exporter/exporterhelper/internal/queue_sender_test.go b/exporter/exporterhelper/internal/queue_sender_test.go index 30b8f28745f..2c89d9c2c00 100644 --- a/exporter/exporterhelper/internal/queue_sender_test.go +++ b/exporter/exporterhelper/internal/queue_sender_test.go @@ -317,7 +317,6 @@ func TestQueueRetryWithDisabledQueue(t *testing.T) { require.NoError(t, be.Shutdown(context.Background())) }) } - } func TestQueueFailedRequestDropped(t *testing.T) { diff --git a/exporter/exporterhelper/logs_batch_test.go b/exporter/exporterhelper/logs_batch_test.go index 92a18bd864b..8ec48520746 100644 --- a/exporter/exporterhelper/logs_batch_test.go +++ b/exporter/exporterhelper/logs_batch_test.go @@ -126,7 +126,6 @@ func TestMergeSplitLogs(t *testing.T) { assert.Equal(t, tt.expected[i], r.(*logsRequest)) } }) - } } diff --git a/exporter/exportertest/mock_consumer_test.go b/exporter/exportertest/mock_consumer_test.go index 7a04137e5f7..a5e297abf48 100644 --- a/exporter/exportertest/mock_consumer_test.go +++ b/exporter/exportertest/mock_consumer_test.go @@ -129,11 +129,9 @@ func TestConsumeLogsNonPermanent(t *testing.T) { assert.Equal(t, 0, mc.reqCounter.error.permanent) assert.Equal(t, 0, mc.reqCounter.success) assert.Equal(t, 1, mc.reqCounter.total) - } func TestConsumeLogsPermanent(t *testing.T) { - mc := newMockConsumer(returnPermanentError) validData := createLog("logId") err := mc.ConsumeLogs(context.Background(), validData) @@ -144,7 +142,6 @@ func TestConsumeLogsPermanent(t *testing.T) { assert.Equal(t, 1, mc.reqCounter.error.permanent) assert.Equal(t, 0, mc.reqCounter.success) assert.Equal(t, 1, mc.reqCounter.total) - } func TestConsumeLogsSuccess(t *testing.T) { @@ -158,7 +155,6 @@ func TestConsumeLogsSuccess(t *testing.T) { assert.Equal(t, 0, mc.reqCounter.error.permanent) assert.Equal(t, 1, mc.reqCounter.success) assert.Equal(t, 1, mc.reqCounter.total) - } func TestConsumeTracesNonPermanent(t *testing.T) { @@ -172,11 +168,9 @@ func TestConsumeTracesNonPermanent(t *testing.T) { assert.Equal(t, 0, mc.reqCounter.error.permanent) assert.Equal(t, 0, mc.reqCounter.success) assert.Equal(t, 1, mc.reqCounter.total) - } func TestConsumeTracesPermanent(t *testing.T) { - mc := newMockConsumer(returnPermanentError) validData := createTrace("traceId") err := mc.ConsumeTraces(context.Background(), validData) @@ -187,7 +181,6 @@ func TestConsumeTracesPermanent(t *testing.T) { assert.Equal(t, 1, mc.reqCounter.error.permanent) assert.Equal(t, 0, mc.reqCounter.success) assert.Equal(t, 1, mc.reqCounter.total) - } func TestConsumeTracesSuccess(t *testing.T) { @@ -201,7 +194,6 @@ func TestConsumeTracesSuccess(t *testing.T) { assert.Equal(t, 0, mc.reqCounter.error.permanent) assert.Equal(t, 1, mc.reqCounter.success) assert.Equal(t, 1, mc.reqCounter.total) - } func TestConsumeMetricsNonPermanent(t *testing.T) { mc := newMockConsumer(returnNonPermanentError) @@ -214,7 +206,6 @@ func TestConsumeMetricsNonPermanent(t *testing.T) { assert.Equal(t, 0, mc.reqCounter.error.permanent) assert.Equal(t, 0, mc.reqCounter.success) assert.Equal(t, 1, mc.reqCounter.total) - } func TestConsumeMetricsPermanent(t *testing.T) { @@ -228,7 +219,6 @@ func TestConsumeMetricsPermanent(t *testing.T) { assert.Equal(t, 1, mc.reqCounter.error.permanent) assert.Equal(t, 0, mc.reqCounter.success) assert.Equal(t, 1, mc.reqCounter.total) - } func TestConsumeMetricsSuccess(t *testing.T) { @@ -242,7 +232,6 @@ func TestConsumeMetricsSuccess(t *testing.T) { assert.Equal(t, 0, mc.reqCounter.error.permanent) assert.Equal(t, 1, mc.reqCounter.success) assert.Equal(t, 1, mc.reqCounter.total) - } func TestCapabilities(t *testing.T) { diff --git a/exporter/internal/queue/default_batcher.go b/exporter/internal/queue/default_batcher.go index 092cf6a2bb3..1d64c540589 100644 --- a/exporter/internal/queue/default_batcher.go +++ b/exporter/internal/queue/default_batcher.go @@ -29,7 +29,6 @@ func (qb *DefaultBatcher) resetTimer() { // startReadingFlushingGoroutine starts a goroutine that reads and then flushes. func (qb *DefaultBatcher) startReadingFlushingGoroutine() { - qb.stopWG.Add(1) go func() { defer qb.stopWG.Done() diff --git a/exporter/internal/queue/persistent_queue.go b/exporter/internal/queue/persistent_queue.go index e7637332ff8..038cb09cc39 100644 --- a/exporter/internal/queue/persistent_queue.go +++ b/exporter/internal/queue/persistent_queue.go @@ -382,7 +382,6 @@ func (pq *persistentQueue[T]) OnProcessingFinished(index uint64, consumeErr erro // Ensure the used size and the channel size are in sync. pq.sizedChannel.syncSize() - } // retrieveAndEnqueueNotDispatchedReqs gets the items for which sending was not finished, cleans the storage diff --git a/exporter/internal/queue/persistent_queue_test.go b/exporter/internal/queue/persistent_queue_test.go index 0efc8a02898..c453b2d760a 100644 --- a/exporter/internal/queue/persistent_queue_test.go +++ b/exporter/internal/queue/persistent_queue_test.go @@ -190,7 +190,6 @@ func TestPersistentQueue_Shutdown(t *testing.T) { for i := 0; i < 1000; i++ { assert.NoError(t, pq.Offer(context.Background(), req)) } - } func TestPersistentQueue_ConsumersProducers(t *testing.T) { diff --git a/exporter/otlpexporter/config_test.go b/exporter/otlpexporter/config_test.go index 153f4215f5e..ae351535df8 100644 --- a/exporter/otlpexporter/config_test.go +++ b/exporter/otlpexporter/config_test.go @@ -139,7 +139,6 @@ func TestUnmarshalInvalidConfig(t *testing.T) { assert.ErrorContains(t, component.ValidateConfig(cfg), tt.errorMsg) }) } - } func TestValidDNSEndpoint(t *testing.T) { diff --git a/extension/auth/client_test.go b/extension/auth/client_test.go index c3666c229b0..cb95a25daaf 100644 --- a/extension/auth/client_test.go +++ b/extension/auth/client_test.go @@ -115,5 +115,4 @@ func TestWithPerRPCCredentials(t *testing.T) { assert.True(t, called) assert.NotNil(t, p) assert.NoError(t, err) - } diff --git a/extension/zpagesextension/zpagesextension.go b/extension/zpagesextension/zpagesextension.go index dc2cd3a7f27..000022689cc 100644 --- a/extension/zpagesextension/zpagesextension.go +++ b/extension/zpagesextension/zpagesextension.go @@ -45,7 +45,6 @@ type registerableTracerProvider interface { } func (zpe *zpagesExtension) Start(ctx context.Context, host component.Host) error { - zPagesMux := http.NewServeMux() sdktracer, ok := zpe.telemetry.TracerProvider.(registerableTracerProvider) diff --git a/otelcol/command_components.go b/otelcol/command_components.go index bb35465a2be..7b3f8e1a8b7 100644 --- a/otelcol/command_components.go +++ b/otelcol/command_components.go @@ -41,7 +41,6 @@ func newComponentsCommand(set CollectorSettings) *cobra.Command { Long: "Outputs available components in this collector distribution including their stability levels. The output format is not stable and can change between releases.", Args: cobra.ExactArgs(0), RunE: func(cmd *cobra.Command, _ []string) error { - factories, err := set.Factories() if err != nil { return fmt.Errorf("failed to initialize factories: %w", err) diff --git a/otelcol/unmarshaler.go b/otelcol/unmarshaler.go index 4967b0a731d..8f2b8e583a1 100644 --- a/otelcol/unmarshaler.go +++ b/otelcol/unmarshaler.go @@ -27,7 +27,6 @@ type configSettings struct { // unmarshal the configSettings from a confmap.Conf. // After the config is unmarshalled, `Validate()` must be called to validate. func unmarshal(v *confmap.Conf, factories Factories) (*configSettings, error) { - telFactory := telemetry.NewFactory() defaultTelConfig := *telFactory.CreateDefaultConfig().(*telemetry.Config) diff --git a/pdata/pcommon/value_test.go b/pdata/pcommon/value_test.go index 50e5dcce6c1..fbe0b611790 100644 --- a/pdata/pcommon/value_test.go +++ b/pdata/pcommon/value_test.go @@ -72,7 +72,6 @@ func TestValueReadOnly(t *testing.T) { v.CopyTo(v2) assert.Equal(t, v.AsRaw(), v2.AsRaw()) assert.Panics(t, func() { v2.CopyTo(v) }) - } func TestValueType(t *testing.T) { diff --git a/pdata/plog/pb_test.go b/pdata/plog/pb_test.go index 0a6bf4bb772..d4b8985ff4c 100644 --- a/pdata/plog/pb_test.go +++ b/pdata/plog/pb_test.go @@ -29,7 +29,6 @@ func TestProtoSizer(t *testing.T) { bytes, err := marshaler.MarshalLogs(ld) require.NoError(t, err) assert.Equal(t, len(bytes), size) - } func TestProtoSizerEmptyLogs(t *testing.T) { diff --git a/pdata/pprofile/pprofileotlp/response.go b/pdata/pprofile/pprofileotlp/response.go index 095ce2f4587..bfc9d729a7c 100644 --- a/pdata/pprofile/pprofileotlp/response.go +++ b/pdata/pprofile/pprofileotlp/response.go @@ -65,7 +65,6 @@ func (ms ExportResponse) unmarshalJsoniter(iter *jsoniter.Iterator) { } return true }) - } // PartialSuccess returns the ExportLogsPartialSuccess associated with this ExportResponse. diff --git a/pdata/ptrace/ptraceotlp/response.go b/pdata/ptrace/ptraceotlp/response.go index 78096bff77c..a5017e27627 100644 --- a/pdata/ptrace/ptraceotlp/response.go +++ b/pdata/ptrace/ptraceotlp/response.go @@ -65,7 +65,6 @@ func (ms ExportResponse) unmarshalJsoniter(iter *jsoniter.Iterator) { } return true }) - } // PartialSuccess returns the ExportLogsPartialSuccess associated with this ExportResponse. diff --git a/processor/batchprocessor/config_test.go b/processor/batchprocessor/config_test.go index 38bb1e0c39b..40b87def7fb 100644 --- a/processor/batchprocessor/config_test.go +++ b/processor/batchprocessor/config_test.go @@ -51,7 +51,6 @@ func TestValidateConfig_ValidBatchSizes(t *testing.T) { SendBatchMaxSize: 1000, } assert.NoError(t, cfg.Validate()) - } func TestValidateConfig_InvalidBatchSize(t *testing.T) { diff --git a/receiver/otlpreceiver/config_test.go b/receiver/otlpreceiver/config_test.go index 2b67125c15d..dc00872dd29 100644 --- a/receiver/otlpreceiver/config_test.go +++ b/receiver/otlpreceiver/config_test.go @@ -141,7 +141,6 @@ func TestUnmarshalConfig(t *testing.T) { }, }, }, cfg) - } func TestUnmarshalConfigUnix(t *testing.T) { diff --git a/receiver/otlpreceiver/fuzz_test.go b/receiver/otlpreceiver/fuzz_test.go index 4915364eb45..39b2b2f6c6a 100644 --- a/receiver/otlpreceiver/fuzz_test.go +++ b/receiver/otlpreceiver/fuzz_test.go @@ -52,6 +52,5 @@ func FuzzReceiverHandlers(f *testing.F) { httpLogsReceiver := logs.New(r.nextLogs, r.obsrepHTTP) handleLogs(resp, req, httpLogsReceiver) } - }) } diff --git a/receiver/receiverprofiles/profiles.go b/receiver/receiverprofiles/profiles.go index 858a9f44120..7308164402f 100644 --- a/receiver/receiverprofiles/profiles.go +++ b/receiver/receiverprofiles/profiles.go @@ -113,5 +113,4 @@ func NewFactory(cfgType component.Type, createDefaultConfig component.CreateDefa } opts.factory.Factory = receiver.NewFactory(cfgType, createDefaultConfig, opts.opts...) return opts.factory - } diff --git a/receiver/receivertest/contract_checker_test.go b/receiver/receivertest/contract_checker_test.go index da2fab0f675..dbe8931b4e7 100644 --- a/receiver/receivertest/contract_checker_test.go +++ b/receiver/receivertest/contract_checker_test.go @@ -230,7 +230,6 @@ func createLog( // TestConsumeContract is an example of testing of the receiver for the contract between the // receiver and next consumer. func TestConsumeContract(t *testing.T) { - // Number of log records to send per scenario. const logsPerTest = 100 @@ -253,7 +252,6 @@ func TestConsumeContract(t *testing.T) { // TestConsumeMetricsContract is an example of testing of the receiver for the contract between the // receiver and next consumer. func TestConsumeMetricsContract(t *testing.T) { - // Number of metric data points to send per scenario. const metricsPerTest = 100 @@ -276,7 +274,6 @@ func TestConsumeMetricsContract(t *testing.T) { // TestConsumeTracesContract is an example of testing of the receiver for the contract between the // receiver and next consumer. func TestConsumeTracesContract(t *testing.T) { - // Number of trace spans to send per scenario. const spansPerTest = 100 diff --git a/receiver/scraperhelper/scrapercontroller.go b/receiver/scraperhelper/scrapercontroller.go index 8767c608407..ecd3e4ff01f 100644 --- a/receiver/scraperhelper/scrapercontroller.go +++ b/receiver/scraperhelper/scrapercontroller.go @@ -78,7 +78,6 @@ func NewScraperControllerReceiver( nextConsumer consumer.Metrics, options ...ScraperControllerOption, ) (component.Component, error) { - if cfg.CollectionInterval <= 0 { return nil, errors.New("collection_interval must be a positive duration") } diff --git a/service/extensions/extensions_test.go b/service/extensions/extensions_test.go index 5a8b3ea462a..6e10b7b22e4 100644 --- a/service/extensions/extensions_test.go +++ b/service/extensions/extensions_test.go @@ -313,7 +313,6 @@ func newConfigWatcherExtension(fn func() error) *configWatcherExtension { } return comp - } func newConfigWatcherExtensionFactory(name component.Type, fn func() error) extension.Factory { diff --git a/service/internal/graph/graph_test.go b/service/internal/graph/graph_test.go index 50c274f053a..d5f4216f561 100644 --- a/service/internal/graph/graph_test.go +++ b/service/internal/graph/graph_test.go @@ -1234,7 +1234,6 @@ func TestConnectorRouter(t *testing.T) { assert.NoError(t, profilesReceiver.ConsumeProfiles(ctx, testdata.GenerateProfiles(1))) assert.Len(t, profilesRight.Profiles, 3) assert.Len(t, profilesLeft.Profiles, 2) - } func TestGraphBuildErrors(t *testing.T) { diff --git a/service/internal/graph/lifecycle_test.go b/service/internal/graph/lifecycle_test.go index 978fddf163f..9fb91f5af6f 100644 --- a/service/internal/graph/lifecycle_test.go +++ b/service/internal/graph/lifecycle_test.go @@ -287,7 +287,6 @@ func TestGraphFailToStartAndShutdown(t *testing.T) { } func TestStatusReportedOnStartupShutdown(t *testing.T) { - rNoErr := &testNode{id: component.MustNewIDWithName("r_no_err", "1")} rStErr := &testNode{id: component.MustNewIDWithName("r_st_err", "1"), startErr: assert.AnError} rSdErr := &testNode{id: component.MustNewIDWithName("r_sd_err", "1"), shutdownErr: assert.AnError} @@ -318,7 +317,6 @@ func TestStatusReportedOnStartupShutdown(t *testing.T) { assert.Equal(t, ev1.Err(), ev2.Err()) } } - } for _, tt := range []struct { diff --git a/service/internal/resource/config_test.go b/service/internal/resource/config_test.go index 9ba74af936a..de20dddd1d1 100644 --- a/service/internal/resource/config_test.go +++ b/service/internal/resource/config_test.go @@ -103,7 +103,6 @@ func TestNew(t *testing.T) { assert.EqualValues(t, tt.want, got) }) } - } func pdataFromSdk(res *sdkresource.Resource) pcommon.Resource { diff --git a/service/internal/status/status_test.go b/service/internal/status/status_test.go index 8c9498bd1e3..6a61b863a26 100644 --- a/service/internal/status/status_test.go +++ b/service/internal/status/status_test.go @@ -175,7 +175,6 @@ func TestValidSeqsToStopped(t *testing.T) { } }) } - } func TestStatusFuncs(t *testing.T) { diff --git a/service/telemetry/logger.go b/service/telemetry/logger.go index 388d8833e8a..6f8e662a990 100644 --- a/service/telemetry/logger.go +++ b/service/telemetry/logger.go @@ -49,7 +49,6 @@ func newLogger(set Settings, cfg Config) (*zap.Logger, log.LoggerProvider, error ), ) })) - } if cfg.Logs.Sampling != nil && cfg.Logs.Sampling.Enabled { diff --git a/service/telemetry/metrics.go b/service/telemetry/metrics.go index 8981200e9f8..0b2690c0af1 100644 --- a/service/telemetry/metrics.go +++ b/service/telemetry/metrics.go @@ -52,7 +52,6 @@ func newMeterProvider(set meterProviderSettings, disableHighCardinality bool) (m } if server != nil { mp.servers = append(mp.servers, server) - } opts = append(opts, sdkmetric.WithReader(r)) } diff --git a/service/telemetry/metrics_test.go b/service/telemetry/metrics_test.go index 4d0595e5014..09ee8616471 100644 --- a/service/telemetry/metrics_test.go +++ b/service/telemetry/metrics_test.go @@ -182,7 +182,6 @@ func TestTelemetryInit(t *testing.T) { require.InDelta(t, metricValue.value, mf.Metric[0].Counter.GetValue(), 0.01, "value for metric %q was different than expected", metricName) } }) - } }