lint: apply x/tools/modernize fixes

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
This commit is contained in:
Tonis Tiigi
2025-03-07 15:00:35 -08:00
parent e19c729d3e
commit d5d3d3d502
50 changed files with 238 additions and 266 deletions

View File

@@ -83,9 +83,9 @@ type Log struct {
// KeyValue is a key-value pair with typed value.
type KeyValue struct {
Key string `json:"key"`
Type ValueType `json:"type,omitempty"`
Value interface{} `json:"value"`
Key string `json:"key"`
Type ValueType `json:"type,omitempty"`
Value any `json:"value"`
}
// DependencyLink shows dependencies between services

View File

@@ -149,7 +149,7 @@ type keyValue struct {
// value is a custom type used to unmarshal otel Value correctly.
type value struct {
Type string
Value interface{}
Value any
}
// UnmarshalJSON implements json.Unmarshaler for Span which allows correctly
@@ -318,7 +318,7 @@ func (kv *keyValue) asAttributeKeyValue() (attribute.KeyValue, error) {
switch sli := kv.Value.Value.(type) {
case []string:
strSli = sli
case []interface{}:
case []any:
for i := range sli {
var v string
// best case we have a string, otherwise, cast it using

View File

@@ -131,7 +131,7 @@ func TestAsAttributeKeyValue(t *testing.T) {
name: "stringslice (interface of string)",
args: args{
Type: attribute.STRINGSLICE.String(),
value: []interface{}{"value1", "value2"},
value: []any{"value1", "value2"},
},
want: attribute.StringSlice("key", []string{"value1", "value2"}),
},
@@ -139,7 +139,7 @@ func TestAsAttributeKeyValue(t *testing.T) {
name: "stringslice (interface mixed)",
args: args{
Type: attribute.STRINGSLICE.String(),
value: []interface{}{"value1", 2},
value: []any{"value1", 2},
},
want: attribute.StringSlice("key", []string{"value1", "2"}),
},