Skip to content

Commit 29616ad

Browse files
committed
[chore]: enable all rules of perfsprint
Signed-off-by: Matthieu MOREL <[email protected]>
1 parent 61e9b35 commit 29616ad

File tree

18 files changed

+48
-44
lines changed

18 files changed

+48
-44
lines changed

.golangci.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -157,11 +157,11 @@ linters-settings:
157157
ignore-words:
158158
- cancelled
159159
perfsprint:
160-
err-error: false
161-
errorf: false
160+
err-error: true
161+
errorf: true
162162
int-conversion: true
163-
sprintf1: false
164-
strconcat: false
163+
sprintf1: true
164+
strconcat: true
165165
revive:
166166
# Sets the default failure confidence.
167167
# This means that linting errors with less than 0.8 confidence will be ignored.

bridge/opencensus/internal/span.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,5 +128,5 @@ func (s *Span) AddLink(l octrace.Link) {
128128

129129
// String prints a string representation of this span.
130130
func (s *Span) String() string {
131-
return fmt.Sprintf("span %s", s.otelSpan.SpanContext().SpanID().String())
131+
return "span " + s.otelSpan.SpanContext().SpanID().String()
132132
}

codes/codes.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ package codes // import "go.opentelemetry.io/otel/codes"
55

66
import (
77
"encoding/json"
8+
"errors"
89
"fmt"
910
"strconv"
1011
)
@@ -63,7 +64,7 @@ func (c *Code) UnmarshalJSON(b []byte) error {
6364
return nil
6465
}
6566
if c == nil {
66-
return fmt.Errorf("nil receiver passed to UnmarshalJSON")
67+
return errors.New("nil receiver passed to UnmarshalJSON")
6768
}
6869

6970
var x interface{}

exporters/otlp/otlpmetric/otlpmetricgrpc/exporter.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ package otlpmetricgrpc // import "go.opentelemetry.io/otel/exporters/otlp/otlpme
55

66
import (
77
"context"
8+
"errors"
89
"fmt"
910
"sync"
1011

@@ -114,7 +115,7 @@ func (e *Exporter) Shutdown(ctx context.Context) error {
114115
return err
115116
}
116117

117-
var errShutdown = fmt.Errorf("gRPC exporter is shutdown")
118+
var errShutdown = errors.New("gRPC exporter is shutdown")
118119

119120
type shutdownClient struct{}
120121

exporters/otlp/otlpmetric/otlpmetricgrpc/internal/oconf/options.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ func cleanPath(urlPath string, defaultPath string) string {
111111
return defaultPath
112112
}
113113
if !path.IsAbs(tmp) {
114-
tmp = fmt.Sprintf("/%s", tmp)
114+
tmp = "/" + tmp
115115
}
116116
return tmp
117117
}

exporters/otlp/otlpmetric/otlpmetrichttp/client.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ func newResponseError(header http.Header, wrapped error) error {
305305

306306
func (e retryableError) Error() string {
307307
if e.err != nil {
308-
return fmt.Sprintf("retry-able request failure: %s", e.err.Error())
308+
return "retry-able request failure: " + e.err.Error()
309309
}
310310

311311
return "retry-able request failure"

exporters/otlp/otlpmetric/otlpmetrichttp/exporter.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ package otlpmetrichttp // import "go.opentelemetry.io/otel/exporters/otlp/otlpme
55

66
import (
77
"context"
8+
"errors"
89
"fmt"
910
"sync"
1011

@@ -114,7 +115,7 @@ func (e *Exporter) Shutdown(ctx context.Context) error {
114115
return err
115116
}
116117

117-
var errShutdown = fmt.Errorf("HTTP exporter is shutdown")
118+
var errShutdown = errors.New("HTTP exporter is shutdown")
118119

119120
type shutdownClient struct{}
120121

exporters/otlp/otlpmetric/otlpmetrichttp/internal/oconf/options.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ func cleanPath(urlPath string, defaultPath string) string {
111111
return defaultPath
112112
}
113113
if !path.IsAbs(tmp) {
114-
tmp = fmt.Sprintf("/%s", tmp)
114+
tmp = "/" + tmp
115115
}
116116
return tmp
117117
}

exporters/otlp/otlptrace/otlptracegrpc/internal/otlpconfig/options.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ func cleanPath(urlPath string, defaultPath string) string {
9898
return defaultPath
9999
}
100100
if !path.IsAbs(tmp) {
101-
tmp = fmt.Sprintf("/%s", tmp)
101+
tmp = "/" + tmp
102102
}
103103
return tmp
104104
}

exporters/otlp/otlptrace/otlptracehttp/client.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ func newResponseError(header http.Header, wrapped error) error {
327327

328328
func (e retryableError) Error() string {
329329
if e.err != nil {
330-
return fmt.Sprintf("retry-able request failure: %s", e.err.Error())
330+
return "retry-able request failure: " + e.err.Error()
331331
}
332332

333333
return "retry-able request failure"

0 commit comments

Comments
 (0)