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:58:10 +01:00
parent 5b1738abf8
commit cbba3bdde7
139 changed files with 798 additions and 799 deletions
@@ -419,20 +419,20 @@ func resourceInfo(ctx context.Context, g, v, r string, index int) (map[string]ma
return nil, errors.Wrap(err, errMsg)
}
var info map[string]interface{}
var info map[string]any
if err := json.Unmarshal([]byte(stdout), &info); err != nil {
return nil, errors.Wrap(err, "unmarshal resource info JSON")
}
items := info["items"].([]interface{})
items := info["items"].([]any)
if len(items) < 1 {
return nil, errors.New("resource info is empty")
}
item := items[0].(map[string]interface{})
metadata := item["metadata"].(map[string]interface{})
annotations := metadata["annotations"].(map[string]interface{})
specs := item["spec"].(map[string]interface{})
item := items[0].(map[string]any)
metadata := item["metadata"].(map[string]any)
annotations := metadata["annotations"].(map[string]any)
specs := item["spec"].(map[string]any)
annoSpec := make(map[string]map[string]string)
+1 -1
View File
@@ -88,7 +88,7 @@ func initConfig() error {
ReportData = &E2EReport{
TestDescription: VeleroCfg.TestCaseDescribe,
OtherFields: make(map[string]interface{}),
OtherFields: make(map[string]any),
}
return nil
+3 -3
View File
@@ -82,11 +82,11 @@ func (m *MetricsCollector) UpdateOneTimeMetrics() {
}
// GetMetrics returns the metrics from all metrics
func (m *MetricsCollector) GetMetrics() map[string]interface{} {
func (m *MetricsCollector) GetMetrics() map[string]any {
m.Mu.Lock() // Acquire the lock before accessing shared resources
defer m.Mu.Unlock() // Release the lock after the function returns
dataMap := make(map[string]interface{})
dataMap := make(map[string]any)
resData := make(map[string]([]map[string]map[string]string))
for _, metric := range m.Metrics {
monitorMetrics := metric.GetMetrics()
@@ -102,7 +102,7 @@ func (m *MetricsCollector) GetMetrics() map[string]interface{} {
}
for _, metric := range m.OneTimeMetrics {
oneTimeMetricsMap := make(map[string]interface{})
oneTimeMetricsMap := make(map[string]any)
monitorMetrics := metric.GetMetrics()
for key, value := range monitorMetrics {
oneTimeMetricsMap[key] = value
+2 -2
View File
@@ -33,9 +33,9 @@ const (
ConfigKeyColorized = "colorized"
)
// VeleroConfig is a map of strings to interface{} for deserializing Velero client config options.
// VeleroConfig is a map of strings to any for deserializing Velero client config options.
// The alias is a way to attach type-asserting convenience methods.
type VeleroConfig map[string]interface{}
type VeleroConfig map[string]any
// LoadConfig loads the Velero client configuration file and returns it as a VeleroConfig. If the
// file does not exist, an empty map is returned.
+3 -3
View File
@@ -31,14 +31,14 @@ func TestFactory(t *testing.T) {
// Env variable should set the namespace if no config or argument are used
os.Setenv("VELERO_NAMESPACE", "env-velero")
f := NewFactory("velero", "", make(map[string]interface{}))
f := NewFactory("velero", "", make(map[string]any))
assert.Equal(t, "env-velero", f.Namespace())
os.Unsetenv("VELERO_NAMESPACE")
// Argument should change the namespace
f = NewFactory("velero", "", make(map[string]interface{}))
f = NewFactory("velero", "", make(map[string]any))
s := "flag-velero"
flags := new(pflag.FlagSet)
@@ -50,7 +50,7 @@ func TestFactory(t *testing.T) {
// An argument overrides the env variable if both are set.
os.Setenv("VELERO_NAMESPACE", "env-velero")
f = NewFactory("velero", "", make(map[string]interface{}))
f = NewFactory("velero", "", make(map[string]any))
flags = new(pflag.FlagSet)
f.BindFlags(flags)
+2 -2
View File
@@ -63,8 +63,8 @@ var UUIDgen uuid.UUID
var VeleroCfg VeleroConfig
type E2EReport struct {
TestDescription string `yaml:"Test Description"`
OtherFields map[string]interface{} `yaml:",inline"`
TestDescription string `yaml:"Test Description"`
OtherFields map[string]any `yaml:",inline"`
}
var ReportData *E2EReport
+1 -1
View File
@@ -47,6 +47,6 @@ func GenerateYamlReport() error {
return nil
}
func AddTestSuitData(dataMap map[string]interface{}, testSuitDesc string) {
func AddTestSuitData(dataMap map[string]any, testSuitDesc string) {
test.ReportData.OtherFields[testSuitDesc] = dataMap
}
+2 -2
View File
@@ -478,7 +478,7 @@ func patchResources(resources *unstructured.UnstructuredList, namespace string,
".dockerconfigjson": credential,
},
}
resource.Object["imagePullSecrets"] = []map[string]interface{}{
resource.Object["imagePullSecrets"] = []map[string]any{
{
"name": "image-pull-secret",
},
@@ -559,7 +559,7 @@ func patchResources(resources *unstructured.UnstructuredList, namespace string,
return nil
}
func toUnstructured(res interface{}) (unstructured.Unstructured, error) {
func toUnstructured(res any) (unstructured.Unstructured, error) {
un := unstructured.Unstructured{}
data, err := json.Marshal(res)
if err != nil {