chore: enable use-any from revive

Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
This commit is contained in:
Matthieu MOREL
2025-01-17 07:51:57 +01:00
parent 5b1738abf8
commit cbba3bdde7
139 changed files with 798 additions and 799 deletions

View File

@@ -46,7 +46,7 @@ func (rp *MockRestartableProcess) ResetIfNeeded() error {
return args.Error(0)
}
func (rp *MockRestartableProcess) GetByKindAndName(key process.KindAndName) (interface{}, error) {
func (rp *MockRestartableProcess) GetByKindAndName(key process.KindAndName) (any, error) {
args := rp.Called(key)
return args.Get(0), args.Error(1)
}
@@ -57,21 +57,21 @@ func (rp *MockRestartableProcess) Stop() {
type RestartableDelegateTest struct {
Function string
Inputs []interface{}
ExpectedErrorOutputs []interface{}
ExpectedDelegateOutputs []interface{}
Inputs []any
ExpectedErrorOutputs []any
ExpectedDelegateOutputs []any
}
type Mockable interface {
Test(t mock.TestingT)
On(method string, args ...interface{}) *mock.Call
On(method string, args ...any) *mock.Call
AssertExpectations(t mock.TestingT) bool
}
func RunRestartableDelegateTests(
t *testing.T,
kind common.PluginKind,
newRestartable func(key process.KindAndName, p process.RestartableProcess) interface{},
newRestartable func(key process.KindAndName, p process.RestartableProcess) any,
newMock func() Mockable,
tests ...RestartableDelegateTest,
) {
@@ -92,7 +92,7 @@ func RunRestartableDelegateTests(
method := reflect.ValueOf(r).MethodByName(tc.Function)
require.NotEmpty(t, method)
// Convert the test case inputs ([]interface{}) to []reflect.Value
// Convert the test case inputs ([]any) to []reflect.Value
var inputValues []reflect.Value
for i := range tc.Inputs {
inputValues = append(inputValues, reflect.ValueOf(tc.Inputs[i]))
@@ -102,7 +102,7 @@ func RunRestartableDelegateTests(
actual := method.Call(inputValues)
// This Function asserts that the actual outputs match the expected outputs
checkOutputs := func(expected []interface{}, actual []reflect.Value) {
checkOutputs := func(expected []any, actual []reflect.Value) {
require.Equal(t, len(expected), len(actual))
for i := range actual {