diff --git a/exporter/clickhouseexporter/exporter_logs.go b/exporter/clickhouseexporter/exporter_logs.go index 5c9077e92e55..43251ec4e77f 100644 --- a/exporter/clickhouseexporter/exporter_logs.go +++ b/exporter/clickhouseexporter/exporter_logs.go @@ -46,10 +46,7 @@ func (e *logsExporter) start(ctx context.Context, _ component.Host) error { return err } - if err := createLogsTable(ctx, e.cfg, e.client); err != nil { - return err - } - return nil + return createLogsTable(ctx, e.cfg, e.client) } // shutdown will shut down the exporter. diff --git a/exporter/clickhouseexporter/exporter_metrics.go b/exporter/clickhouseexporter/exporter_metrics.go index 62a100138014..120543888115 100644 --- a/exporter/clickhouseexporter/exporter_metrics.go +++ b/exporter/clickhouseexporter/exporter_metrics.go @@ -42,10 +42,7 @@ func (e *metricsExporter) start(ctx context.Context, _ component.Host) error { } internal.SetLogger(e.logger) - if err := internal.NewMetricsTable(ctx, e.cfg.MetricsTableName, e.cfg.TTLDays, e.client); err != nil { - return err - } - return nil + return internal.NewMetricsTable(ctx, e.cfg.MetricsTableName, e.cfg.TTLDays, e.client) } // shutdown will shut down the exporter. diff --git a/exporter/clickhouseexporter/exporter_traces.go b/exporter/clickhouseexporter/exporter_traces.go index 2333ca2a1d63..e7c5e1e4ffe5 100644 --- a/exporter/clickhouseexporter/exporter_traces.go +++ b/exporter/clickhouseexporter/exporter_traces.go @@ -46,10 +46,7 @@ func (e *tracesExporter) start(ctx context.Context, _ component.Host) error { return err } - if err := createTracesTable(ctx, e.cfg, e.client); err != nil { - return err - } - return nil + return createTracesTable(ctx, e.cfg, e.client) } // shutdown will shut down the exporter. diff --git a/exporter/datadogexporter/internal/logs/sender.go b/exporter/datadogexporter/internal/logs/sender.go index 21c32241522c..1950661270f1 100644 --- a/exporter/datadogexporter/internal/logs/sender.go +++ b/exporter/datadogexporter/internal/logs/sender.go @@ -70,10 +70,7 @@ func (s *Sender) SubmitLogs(ctx context.Context, payload []datadogV2.HTTPLogItem batch = []datadogV2.HTTPLogItem{p} prevtags = tags } - if err := s.handleSubmitLog(ctx, batch, tags); err != nil { - return err - } - return nil + return s.handleSubmitLog(ctx, batch, tags) } func (s *Sender) handleSubmitLog(ctx context.Context, batch []datadogV2.HTTPLogItem, tags string) error { diff --git a/exporter/fileexporter/file_exporter.go b/exporter/fileexporter/file_exporter.go index bef9ed4d8bc7..2765fb3787dd 100644 --- a/exporter/fileexporter/file_exporter.go +++ b/exporter/fileexporter/file_exporter.go @@ -102,12 +102,8 @@ func exportMessageAsBuffer(e *fileExporter, buf []byte) error { // each encoded object is preceded by 4 bytes (an unsigned 32 bit integer) data := make([]byte, 4, 4+len(buf)) binary.BigEndian.PutUint32(data, uint32(len(buf))) - data = append(data, buf...) - if err := binary.Write(e.file, binary.BigEndian, data); err != nil { - return err - } - return nil + return binary.Write(e.file, binary.BigEndian, append(data, buf...)) } // startFlusher starts the flusher. diff --git a/exporter/mezmoexporter/exporter.go b/exporter/mezmoexporter/exporter.go index d21fcc6b313b..1a7292b73478 100644 --- a/exporter/mezmoexporter/exporter.go +++ b/exporter/mezmoexporter/exporter.go @@ -51,7 +51,7 @@ func newLogsExporter(config *Config, settings component.TelemetrySettings, build return e } -func (m *mezmoExporter) pushLogData(ctx context.Context, ld plog.Logs) error { +func (m *mezmoExporter) pushLogData(_ context.Context, ld plog.Logs) error { m.wg.Add(1) defer m.wg.Done() @@ -158,12 +158,7 @@ func (m *mezmoExporter) logDataToMezmo(ld plog.Logs) error { } } - str := b.String() + "]}" - if errs = m.sendLinesToMezmo(str); errs != nil { - return errs - } - - return nil + return m.sendLinesToMezmo(b.String() + "]}") } func (m *mezmoExporter) sendLinesToMezmo(post string) (errs error) { diff --git a/extension/storage/dbstorage/client.go b/extension/storage/dbstorage/client.go index c7f17e1707cc..69e95155bebc 100644 --- a/extension/storage/dbstorage/client.go +++ b/extension/storage/dbstorage/client.go @@ -112,8 +112,5 @@ func (c *dbStorageClient) Close(_ context.Context) error { if err := c.deleteQuery.Close(); err != nil { return err } - if err := c.getQuery.Close(); err != nil { - return err - } - return nil + return c.getQuery.Close() } diff --git a/internal/coreinternal/golden/golden.go b/internal/coreinternal/golden/golden.go index 92558e7c2e00..2cf933c2591f 100644 --- a/internal/coreinternal/golden/golden.go +++ b/internal/coreinternal/golden/golden.go @@ -73,10 +73,7 @@ func writeMetrics(filePath string, metrics pmetric.Metrics) error { if err != nil { return err } - if err := os.WriteFile(filePath, b, 0600); err != nil { - return err - } - return nil + return os.WriteFile(filePath, b, 0600) } // ReadLogs reads a plog.Logs from the specified YAML or JSON file. diff --git a/receiver/awsfirehosereceiver/config.go b/receiver/awsfirehosereceiver/config.go index d2c05dd34309..85825968daa6 100644 --- a/receiver/awsfirehosereceiver/config.go +++ b/receiver/awsfirehosereceiver/config.go @@ -32,8 +32,5 @@ func (c *Config) Validate() error { if c.RecordType == "" { return errors.New("must specify record type") } - if err := validateRecordType(c.RecordType); err != nil { - return err - } - return nil + return validateRecordType(c.RecordType) } diff --git a/receiver/prometheusreceiver/metrics_receiver.go b/receiver/prometheusreceiver/metrics_receiver.go index 14fd34abceb9..7ac565efc90a 100644 --- a/receiver/prometheusreceiver/metrics_receiver.go +++ b/receiver/prometheusreceiver/metrics_receiver.go @@ -232,10 +232,7 @@ func (r *pReceiver) applyCfg(cfg *config.Config) error { discoveryCfg[scrapeConfig.JobName] = scrapeConfig.ServiceDiscoveryConfigs r.settings.Logger.Info("Scrape job added", zap.String("jobName", scrapeConfig.JobName)) } - if err := r.discoveryManager.ApplyConfig(discoveryCfg); err != nil { - return err - } - return nil + return r.discoveryManager.ApplyConfig(discoveryCfg) } func (r *pReceiver) initPrometheusComponents(ctx context.Context, host component.Host, logger log.Logger) error { diff --git a/receiver/statsdreceiver/receiver.go b/receiver/statsdreceiver/receiver.go index 49d90c175c00..0eb2b10707d1 100644 --- a/receiver/statsdreceiver/receiver.go +++ b/receiver/statsdreceiver/receiver.go @@ -131,10 +131,5 @@ func (r *statsdReceiver) Shutdown(context.Context) error { } func (r *statsdReceiver) Flush(ctx context.Context, metrics pmetric.Metrics, nextConsumer consumer.Metrics) error { - error := nextConsumer.ConsumeMetrics(ctx, metrics) - if error != nil { - return error - } - - return nil + return nextConsumer.ConsumeMetrics(ctx, metrics) }