Skip to content

Commit 2c15a77

Browse files
authored
Fix lint issues for golangci-lint 1.62.0 (#5967)
This fixes the new lint issues brough by the golangci-lint upgrade in #5966
1 parent 0bf9572 commit 2c15a77

File tree

15 files changed

+37
-44
lines changed

15 files changed

+37
-44
lines changed

attribute/key_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ func TestJSONValue(t *testing.T) {
4747

4848
data, err := json.Marshal(kvs)
4949
require.NoError(t, err)
50-
require.Equal(t,
50+
require.JSONEq(t,
5151
`[{"Key":"A","Value":{"Type":"STRING","Value":"B"}},{"Key":"C","Value":{"Type":"INT64","Value":1}}]`,
5252
string(data))
5353
}

baggage/baggage.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -355,15 +355,15 @@ func parseMember(member string) (Member, error) {
355355
}
356356

357357
// replaceInvalidUTF8Sequences replaces invalid UTF-8 sequences with '�'.
358-
func replaceInvalidUTF8Sequences(cap int, unescapeVal string) string {
358+
func replaceInvalidUTF8Sequences(c int, unescapeVal string) string {
359359
if utf8.ValidString(unescapeVal) {
360360
return unescapeVal
361361
}
362362
// W3C baggage spec:
363363
// https://github.com/w3c/baggage/blob/8c215efbeebd3fa4b1aceb937a747e56444f22f3/baggage/HTTP_HEADER_FORMAT.md?plain=1#L69
364364

365365
var b strings.Builder
366-
b.Grow(cap)
366+
b.Grow(c)
367367
for i := 0; i < len(unescapeVal); {
368368
r, size := utf8.DecodeRuneInString(unescapeVal[i:])
369369
if r == utf8.RuneError && size == 1 {

baggage/baggage_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -593,7 +593,7 @@ func TestBaggageParseValue(t *testing.T) {
593593
for _, tc := range testcases {
594594
t.Run(tc.name, func(t *testing.T) {
595595
b, err := Parse(tc.in)
596-
assert.Empty(t, err)
596+
assert.NoError(t, err)
597597

598598
val := b.Members()[0].Value()
599599

bridge/opentracing/mix_test.go

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -600,13 +600,6 @@ func simpleSpanIDs(count int) []trace.SpanID {
600600
return base[:count]
601601
}
602602

603-
func min(a, b int) int {
604-
if a > b {
605-
return b
606-
}
607-
return a
608-
}
609-
610603
func runOtelOTOtel(t *testing.T, ctx context.Context, name string, callback func(*testing.T, context.Context) context.Context) {
611604
tr := otel.Tracer("")
612605
ctx, span := tr.Start(ctx, fmt.Sprintf("%s_Otel_OTOtel", name), trace.WithSpanKind(trace.SpanKindClient))

exporters/otlp/otlplog/otlploghttp/client_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -434,8 +434,8 @@ func newWeakCertificate() (tls.Certificate, error) {
434434
}
435435
notBefore := time.Now()
436436
notAfter := notBefore.Add(time.Hour)
437-
max := new(big.Int).Lsh(big.NewInt(1), 128)
438-
sn, err := rand.Int(rand.Reader, max)
437+
m := new(big.Int).Lsh(big.NewInt(1), 128)
438+
sn, err := rand.Int(rand.Reader, m)
439439
if err != nil {
440440
return tls.Certificate{}, err
441441
}

exporters/otlp/otlpmetric/otlpmetricgrpc/internal/otest/client.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ var (
4343
Value: &cpb.AnyValue_StringValue{StringValue: "v0.1.0"},
4444
}}
4545

46-
min, max, sum = 2.0, 4.0, 90.0
47-
hdp = []*mpb.HistogramDataPoint{
46+
mi, ma, sum = 2.0, 4.0, 90.0
47+
hdp = []*mpb.HistogramDataPoint{
4848
{
4949
Attributes: []*cpb.KeyValue{kvAlice},
5050
StartTimeUnixNano: uint64(start.UnixNano()),
@@ -53,8 +53,8 @@ var (
5353
Sum: &sum,
5454
ExplicitBounds: []float64{1, 5},
5555
BucketCounts: []uint64{0, 30, 0},
56-
Min: &min,
57-
Max: &max,
56+
Min: &mi,
57+
Max: &ma,
5858
},
5959
}
6060

exporters/otlp/otlpmetric/otlpmetricgrpc/internal/otest/collector.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -413,8 +413,8 @@ func weakCertificate() (tls.Certificate, error) {
413413
}
414414
notBefore := time.Now()
415415
notAfter := notBefore.Add(time.Hour)
416-
max := new(big.Int).Lsh(big.NewInt(1), 128)
417-
sn, err := rand.Int(rand.Reader, max)
416+
m := new(big.Int).Lsh(big.NewInt(1), 128)
417+
sn, err := rand.Int(rand.Reader, m)
418418
if err != nil {
419419
return tls.Certificate{}, err
420420
}

exporters/otlp/otlpmetric/otlpmetrichttp/internal/otest/client.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ var (
4343
Value: &cpb.AnyValue_StringValue{StringValue: "v0.1.0"},
4444
}}
4545

46-
min, max, sum = 2.0, 4.0, 90.0
47-
hdp = []*mpb.HistogramDataPoint{
46+
mi, ma, sum = 2.0, 4.0, 90.0
47+
hdp = []*mpb.HistogramDataPoint{
4848
{
4949
Attributes: []*cpb.KeyValue{kvAlice},
5050
StartTimeUnixNano: uint64(start.UnixNano()),
@@ -53,8 +53,8 @@ var (
5353
Sum: &sum,
5454
ExplicitBounds: []float64{1, 5},
5555
BucketCounts: []uint64{0, 30, 0},
56-
Min: &min,
57-
Max: &max,
56+
Min: &mi,
57+
Max: &ma,
5858
},
5959
}
6060

exporters/otlp/otlpmetric/otlpmetrichttp/internal/otest/collector.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -413,8 +413,8 @@ func weakCertificate() (tls.Certificate, error) {
413413
}
414414
notBefore := time.Now()
415415
notAfter := notBefore.Add(time.Hour)
416-
max := new(big.Int).Lsh(big.NewInt(1), 128)
417-
sn, err := rand.Int(rand.Reader, max)
416+
m := new(big.Int).Lsh(big.NewInt(1), 128)
417+
sn, err := rand.Int(rand.Reader, m)
418418
if err != nil {
419419
return tls.Certificate{}, err
420420
}

internal/shared/otlp/otlpmetric/otest/client.go.tmpl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ var (
4343
Value: &cpb.AnyValue_StringValue{StringValue: "v0.1.0"},
4444
}}
4545

46-
min, max, sum = 2.0, 4.0, 90.0
47-
hdp = []*mpb.HistogramDataPoint{
46+
mi, ma, sum = 2.0, 4.0, 90.0
47+
hdp = []*mpb.HistogramDataPoint{
4848
{
4949
Attributes: []*cpb.KeyValue{kvAlice},
5050
StartTimeUnixNano: uint64(start.UnixNano()),
@@ -53,8 +53,8 @@ var (
5353
Sum: &sum,
5454
ExplicitBounds: []float64{1, 5},
5555
BucketCounts: []uint64{0, 30, 0},
56-
Min: &min,
57-
Max: &max,
56+
Min: &mi,
57+
Max: &ma,
5858
},
5959
}
6060

0 commit comments

Comments
 (0)