mirror of
https://github.com/vmware-tanzu/velero.git
synced 2026-09-20 23:14:17 +00:00
chore: enable use-any from revive
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
This commit is contained in:
@@ -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)
|
||||
|
||||
|
||||
@@ -88,7 +88,7 @@ func initConfig() error {
|
||||
|
||||
ReportData = &E2EReport{
|
||||
TestDescription: VeleroCfg.TestCaseDescribe,
|
||||
OtherFields: make(map[string]interface{}),
|
||||
OtherFields: make(map[string]any),
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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
@@ -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
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user