Skip to content

Commit 053aef4

Browse files
committed
updated linting rules to go1.24
Signed-off-by: Frederic BIDON <[email protected]>
1 parent df12108 commit 053aef4

File tree

2 files changed

+15
-15
lines changed

2 files changed

+15
-15
lines changed

.golangci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ linters:
1616
- godox
1717
- gosmopolitan
1818
- inamedparam
19-
- intrange # disabled while < go1.22
19+
#- intrange # disabled while < go1.22
2020
- ireturn
2121
- lll
2222
- musttag

schema_test.go

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import (
2424
)
2525

2626
var schema = Schema{
27-
VendorExtensible: VendorExtensible{Extensions: map[string]interface{}{"x-framework": "go-swagger"}},
27+
VendorExtensible: VendorExtensible{Extensions: map[string]any{"x-framework": "go-swagger"}},
2828
SchemaProps: SchemaProps{
2929
Ref: MustCreateRef("Cat"),
3030
Type: []string{"string"},
@@ -43,7 +43,7 @@ var schema = Schema{
4343
MinItems: int64Ptr(5),
4444
UniqueItems: true,
4545
MultipleOf: float64Ptr(5),
46-
Enum: []interface{}{"hello", "world"},
46+
Enum: []any{"hello", "world"},
4747
MaxProperties: int64Ptr(5),
4848
MinProperties: int64Ptr(1),
4949
Required: []string{"id", "name"},
@@ -66,12 +66,12 @@ var schema = Schema{
6666
Description: "the documentation etc",
6767
URL: "http://readthedocs.org/swagger",
6868
},
69-
Example: []interface{}{
70-
map[string]interface{}{
69+
Example: []any{
70+
map[string]any{
7171
"id": 1,
7272
"name": "a book",
7373
},
74-
map[string]interface{}{
74+
map[string]any{
7575
"id": 2,
7676
"name": "the thing",
7777
},
@@ -151,12 +151,12 @@ var schemaJSON = `{
151151

152152
func TestSchema(t *testing.T) {
153153

154-
expected := map[string]interface{}{}
154+
expected := map[string]any{}
155155
_ = json.Unmarshal([]byte(schemaJSON), &expected)
156156
b, err := json.Marshal(schema)
157157
require.NoError(t, err)
158158

159-
var actual map[string]interface{}
159+
var actual map[string]any
160160
require.NoError(t, json.Unmarshal(b, &actual))
161161
assert.Equal(t, expected, actual)
162162

@@ -193,12 +193,12 @@ func TestSchema(t *testing.T) {
193193
assert.Equal(t, schema.AdditionalProperties, actual2.AdditionalProperties)
194194
assert.Equal(t, schema.Extensions, actual2.Extensions)
195195

196-
examples := actual2.Example.([]interface{})
197-
expEx := schema.Example.([]interface{})
198-
ex1 := examples[0].(map[string]interface{})
199-
ex2 := examples[1].(map[string]interface{})
200-
exp1 := expEx[0].(map[string]interface{})
201-
exp2 := expEx[1].(map[string]interface{})
196+
examples := actual2.Example.([]any)
197+
expEx := schema.Example.([]any)
198+
ex1 := examples[0].(map[string]any)
199+
ex2 := examples[1].(map[string]any)
200+
exp1 := expEx[0].(map[string]any)
201+
exp2 := expEx[1].(map[string]any)
202202

203203
assert.EqualValues(t, exp1["id"], ex1["id"]) //nolint:testifylint // false positive: types are different
204204
assert.Equal(t, exp1["name"], ex1["name"])
@@ -207,7 +207,7 @@ func TestSchema(t *testing.T) {
207207
}
208208

209209
func BenchmarkSchemaUnmarshal(b *testing.B) {
210-
for i := 0; i < b.N; i++ {
210+
for b.Loop() {
211211
sch := &Schema{}
212212
_ = sch.UnmarshalJSON([]byte(schemaJSON))
213213
}

0 commit comments

Comments
 (0)