all: gofmt -w -r 'interface{} -> any' .

Updates #9687
This commit is contained in:
Bjørn Erik Pedersen
2022-03-17 22:03:27 +01:00
parent 423594e03a
commit b80853de90
342 changed files with 2118 additions and 2102 deletions

View File

@@ -40,10 +40,10 @@ func TestSort(t *testing.T) {
}
for i, test := range []struct {
seq interface{}
sortByField interface{}
seq any
sortByField any
sortAsc string
expect interface{}
expect any
}{
{[]string{"class1", "class2", "class3"}, nil, "asc", []string{"class1", "class2", "class3"}},
{[]string{"class3", "class1", "class2"}, nil, "asc", []string{"class1", "class2", "class3"}},
@@ -205,17 +205,17 @@ func TestSort(t *testing.T) {
},
// interface slice with missing elements
{
[]interface{}{
map[interface{}]interface{}{"Title": "Foo", "Weight": 10},
map[interface{}]interface{}{"Title": "Bar"},
map[interface{}]interface{}{"Title": "Zap", "Weight": 5},
[]any{
map[any]any{"Title": "Foo", "Weight": 10},
map[any]any{"Title": "Bar"},
map[any]any{"Title": "Zap", "Weight": 5},
},
"Weight",
"asc",
[]interface{}{
map[interface{}]interface{}{"Title": "Bar"},
map[interface{}]interface{}{"Title": "Zap", "Weight": 5},
map[interface{}]interface{}{"Title": "Foo", "Weight": 10},
[]any{
map[any]any{"Title": "Bar"},
map[any]any{"Title": "Zap", "Weight": 5},
map[any]any{"Title": "Foo", "Weight": 10},
},
},
// test boolean values
@@ -239,7 +239,7 @@ func TestSort(t *testing.T) {
{nil, nil, "asc", false},
} {
t.Run(fmt.Sprintf("test%d", i), func(t *testing.T) {
var result interface{}
var result any
var err error
if test.sortByField == nil {
result, err = ns.Sort(test.seq)