chore(all): replace all fmt.Errorf without paramters with errors.New (#21068)

This commit is contained in:
yukionfire
2024-07-25 14:54:49 +02:00
committed by GitHub
parent 6a2d039e12
commit d6ad92db0f
57 changed files with 127 additions and 103 deletions
+3 -2
View File
@@ -3,6 +3,7 @@ package telemetry
import (
"bytes"
"encoding/json"
"errors"
"fmt"
"net/http"
"time"
@@ -145,7 +146,7 @@ func (m *Metrics) Gather(format string) (GatherResponse, error) {
// If Prometheus metrics are not enabled, it returns an error.
func (m *Metrics) gatherPrometheus() (GatherResponse, error) {
if !m.prometheusEnabled {
return GatherResponse{}, fmt.Errorf("prometheus metrics are not enabled")
return GatherResponse{}, errors.New("prometheus metrics are not enabled")
}
metricsFamilies, err := prometheus.DefaultGatherer.Gather()
@@ -171,7 +172,7 @@ func (m *Metrics) gatherPrometheus() (GatherResponse, error) {
func (m *Metrics) gatherGeneric() (GatherResponse, error) {
gm, ok := m.sink.(DisplayableSink)
if !ok {
return GatherResponse{}, fmt.Errorf("non in-memory metrics sink does not support generic format")
return GatherResponse{}, errors.New("non in-memory metrics sink does not support generic format")
}
summary, err := gm.DisplayMetrics(nil, nil)