diff --git a/common/daemon/root_test.go b/common/daemon/root_test.go index 7c5edecb..02035657 100644 --- a/common/daemon/root_test.go +++ b/common/daemon/root_test.go @@ -4,7 +4,7 @@ package daemon import ( - "fmt" + "errors" "testing" "time" @@ -87,7 +87,7 @@ func TestTombTracking(t *testing.T) { case <-tomb.Dying(): t.Fatalf("Dying() should not happen inside the tomb") case <-ch: - return fmt.Errorf("crashing") + return errors.New("crashing") } return nil }) diff --git a/orchestrator/clickhouse/migrations.go b/orchestrator/clickhouse/migrations.go index 77c81c4a..9f210092 100644 --- a/orchestrator/clickhouse/migrations.go +++ b/orchestrator/clickhouse/migrations.go @@ -5,6 +5,7 @@ package clickhouse import ( "context" + "errors" "fmt" "net" "strings" @@ -66,7 +67,7 @@ func (c *Component) migrateDatabase() error { return fmt.Errorf("unable to parse cluster settings: %w", err) } if shardNum == 0 { - return fmt.Errorf("cannot get the number of shards for the cluster") + return errors.New("cannot get the number of shards for the cluster") } c.shards = int(shardNum) } diff --git a/orchestrator/clickhouse/root.go b/orchestrator/clickhouse/root.go index fea4fad0..b8f3fe63 100644 --- a/orchestrator/clickhouse/root.go +++ b/orchestrator/clickhouse/root.go @@ -5,6 +5,7 @@ package clickhouse import ( + "errors" "fmt" "os" "sort" @@ -84,7 +85,7 @@ func New(r *reporter.Reporter, configuration Configuration, dependencies Depende return c.config.Resolutions[i].Interval < c.config.Resolutions[j].Interval }) if len(c.config.Resolutions) == 0 || c.config.Resolutions[0].Interval != 0 { - return nil, fmt.Errorf("resolutions need to be configured, including interval: 0") + return nil, errors.New("resolutions need to be configured, including interval: 0") } c.d.Daemon.Track(&c.t, "orchestrator/clickhouse") diff --git a/outlet/metadata/provider/gnmi/collector.go b/outlet/metadata/provider/gnmi/collector.go index 482dc72c..c1bd1d25 100644 --- a/outlet/metadata/provider/gnmi/collector.go +++ b/outlet/metadata/provider/gnmi/collector.go @@ -5,6 +5,7 @@ package gnmi import ( "context" + "errors" "fmt" "net" "net/netip" @@ -333,5 +334,5 @@ func (p *Provider) detectModelAndEncoding(ctx context.Context, tg *target.Target return model, encoding, nil } } - return Model{}, "", fmt.Errorf("no compatible model found") + return Model{}, "", errors.New("no compatible model found") } diff --git a/outlet/metadata/provider/snmp/poller.go b/outlet/metadata/provider/snmp/poller.go index a106c80e..9d85c7cc 100644 --- a/outlet/metadata/provider/snmp/poller.go +++ b/outlet/metadata/provider/snmp/poller.go @@ -117,7 +117,7 @@ func (p *Provider) Poll(ctx context.Context, exporter, agent netip.Addr, port ui results = slices.Clone(currentResult.Variables) } else { if len(results) != len(currentResult.Variables) { - logError(fmt.Errorf("SNMP mismatch on variable lengths")) + logError(errors.New("SNMP mismatch on variable lengths")) } for idx := range results { switch results[idx].Type { @@ -128,7 +128,7 @@ func (p *Provider) Poll(ctx context.Context, exporter, agent netip.Addr, port ui } } if len(results) != len(requests) { - logError(fmt.Errorf("SNMP mismatch on variable lengths")) + logError(errors.New("SNMP mismatch on variable lengths")) } p.metrics.times.WithLabelValues(exporterStr).Observe(time.Since(start).Seconds())