1
0
mirror of https://github.com/open-telemetry/opentelemetry-go.git synced 2026-06-03 18:35:08 +02:00
Use
https://pkg.go.dev/golang.org/x/tools/gopls/internal/analysis/modernize
to update code to new style.

---------

Co-authored-by: Flc゛ <four_leaf_clover@foxmail.com>
Co-authored-by: Damien Mathieu <42@dmathieu.com>
This commit is contained in:
Mikhail Mazurskiy
2025-07-29 18:19:11 +10:00
committed by GitHub
parent 7bcbb6a49a
commit 5e1c62a2d5
97 changed files with 234 additions and 268 deletions
+6 -10
View File
@@ -7,6 +7,8 @@
package internaltest // import "go.opentelemetry.io/otel/internal/internaltest"
import (
"maps"
"slices"
"sync"
"testing"
@@ -28,9 +30,7 @@ var _ propagation.TextMapCarrier = (*TextMapCarrier)(nil)
// NewTextMapCarrier returns a new *TextMapCarrier populated with data.
func NewTextMapCarrier(data map[string]string) *TextMapCarrier {
copied := make(map[string]string, len(data))
for k, v := range data {
copied[k] = v
}
maps.Copy(copied, data)
return &TextMapCarrier{data: copied}
}
@@ -58,10 +58,8 @@ func (c *TextMapCarrier) Get(key string) string {
func (c *TextMapCarrier) GotKey(t *testing.T, key string) bool {
c.mtx.Lock()
defer c.mtx.Unlock()
for _, k := range c.gets {
if k == key {
return true
}
if slices.Contains(c.gets, key) {
return true
}
t.Errorf("TextMapCarrier.Get(%q) has not been called", key)
return false
@@ -120,9 +118,7 @@ func (c *TextMapCarrier) SetN(t *testing.T, n int) bool {
// Reset zeros out the recording state and sets the carried values to data.
func (c *TextMapCarrier) Reset(data map[string]string) {
copied := make(map[string]string, len(data))
for k, v := range data {
copied[k] = v
}
maps.Copy(copied, data)
c.mtx.Lock()
defer c.mtx.Unlock()