From d97f3e6834e73bf73c07844a4ed2cc4f400b2ba4 Mon Sep 17 00:00:00 2001 From: Martin Schuppert Date: Wed, 4 Sep 2024 08:39:38 +0200 Subject: [PATCH] [govet] Fix printf: non-constant format string in call to Signed-off-by: Martin Schuppert (cherry picked from commit 7b917a0af8fd942458d352515c9228f99b6d63f4) --- modules/common/condition/funcs.go | 8 ++++---- modules/openstack/domain.go | 2 +- modules/openstack/limits.go | 4 ++-- modules/openstack/project.go | 6 +++--- modules/openstack/role.go | 2 +- modules/openstack/service.go | 2 +- modules/openstack/user.go | 4 ++-- 7 files changed, 14 insertions(+), 14 deletions(-) diff --git a/modules/common/condition/funcs.go b/modules/common/condition/funcs.go index a01af9a1..65e2b8d7 100644 --- a/modules/common/condition/funcs.go +++ b/modules/common/condition/funcs.go @@ -337,7 +337,7 @@ func (conditions *Conditions) Mirror(t Type) *Condition { cg := g[groupOrder(*TrueCondition(ReadyCondition, "foo"))] if len(cg.conditions) > 0 && cg.conditions.IsTrue(ReadyCondition) { c := cg.conditions.Get(ReadyCondition) - mirrorCondition := TrueCondition(t, c.Message) + mirrorCondition := TrueCondition(t, "%s", c.Message) mirrorCondition.LastTransitionTime = c.LastTransitionTime return mirrorCondition @@ -355,19 +355,19 @@ func (conditions *Conditions) Mirror(t Type) *Condition { c := (*cl)[0] if c.Status == corev1.ConditionTrue { - mirrorCondition = TrueCondition(t, c.Message) + mirrorCondition = TrueCondition(t, "%s", c.Message) mirrorCondition.LastTransitionTime = c.LastTransitionTime break } if c.Status == corev1.ConditionFalse { - mirrorCondition = FalseCondition(t, c.Reason, c.Severity, c.Message) + mirrorCondition = FalseCondition(t, c.Reason, c.Severity, "%s", c.Message) mirrorCondition.LastTransitionTime = c.LastTransitionTime break } if c.Status == corev1.ConditionUnknown { - mirrorCondition = UnknownCondition(t, c.Reason, c.Message) + mirrorCondition = UnknownCondition(t, c.Reason, "%s", c.Message) mirrorCondition.LastTransitionTime = c.LastTransitionTime break } diff --git a/modules/openstack/domain.go b/modules/openstack/domain.go index f29c84fa..4045204d 100644 --- a/modules/openstack/domain.go +++ b/modules/openstack/domain.go @@ -38,7 +38,7 @@ func (o *OpenStack) CreateDomain(log logr.Logger, d Domain) (string, error) { } domainID = domain.ID } else { - return domainID, fmt.Errorf(fmt.Sprintf("Multiple domains named \"%s\" found", d.Name)) + return domainID, fmt.Errorf("Multiple domains named \"%s\" found", d.Name) } return domainID, nil diff --git a/modules/openstack/limits.go b/modules/openstack/limits.go index 8240701d..a0fe5ce8 100644 --- a/modules/openstack/limits.go +++ b/modules/openstack/limits.go @@ -86,7 +86,7 @@ func (o *OpenStack) CreateLimit( } limitID = createdLimits[0].ID } else { - return limitID, fmt.Errorf(fmt.Sprintf("multiple limits named \"%s\" found", l.ResourceName)) + return limitID, fmt.Errorf("multiple limits named \"%s\" found", l.ResourceName) } return limitID, nil @@ -156,7 +156,7 @@ func (o *OpenStack) CreateOrUpdateRegisteredLimit( } limitID = createdLimits[0].ID } else { - return limitID, fmt.Errorf(fmt.Sprintf("multiple limits named \"%s\" found", l.ResourceName)) + return limitID, fmt.Errorf("multiple limits named \"%s\" found", l.ResourceName) } return limitID, nil diff --git a/modules/openstack/project.go b/modules/openstack/project.go index 17b65520..97bd3b00 100644 --- a/modules/openstack/project.go +++ b/modules/openstack/project.go @@ -62,7 +62,7 @@ func (o *OpenStack) CreateProject( } projectID = project.ID } else { - return projectID, fmt.Errorf(fmt.Sprintf("multiple projects named \"%s\" found", p.Name)) + return projectID, fmt.Errorf("multiple projects named \"%s\" found", p.Name) } return projectID, nil @@ -84,9 +84,9 @@ func (o *OpenStack) GetProject( } if len(allProjects) == 0 { - return nil, fmt.Errorf(fmt.Sprintf("%s %s", projectName, ProjectNotFound)) + return nil, fmt.Errorf("%s %s", projectName, ProjectNotFound) } else if len(allProjects) > 1 { - return nil, fmt.Errorf(fmt.Sprintf("multiple project named \"%s\" found", projectName)) + return nil, fmt.Errorf("multiple project named \"%s\" found", projectName) } return &allProjects[0], nil diff --git a/modules/openstack/role.go b/modules/openstack/role.go index f3c36f50..3467bdf0 100644 --- a/modules/openstack/role.go +++ b/modules/openstack/role.go @@ -80,7 +80,7 @@ func (o *OpenStack) GetRole( } if len(allRoles) == 0 { - return nil, fmt.Errorf(fmt.Sprintf("%s %s", roleName, RoleNotFound)) + return nil, fmt.Errorf("%s %s", roleName, RoleNotFound) } return &allRoles[0], nil diff --git a/modules/openstack/service.go b/modules/openstack/service.go index ee0b550a..0a89fe06 100644 --- a/modules/openstack/service.go +++ b/modules/openstack/service.go @@ -96,7 +96,7 @@ func (o *OpenStack) GetService( } if len(allServices) == 0 { - return nil, fmt.Errorf(fmt.Sprintf("%s %s", serviceName, ServiceNotFound)) + return nil, fmt.Errorf("%s %s", serviceName, ServiceNotFound) } return &allServices[0], nil diff --git a/modules/openstack/user.go b/modules/openstack/user.go index 8f5cc136..35c015f2 100644 --- a/modules/openstack/user.go +++ b/modules/openstack/user.go @@ -94,9 +94,9 @@ func (o *OpenStack) GetUser( } if len(allUsers) == 0 { - return nil, fmt.Errorf(fmt.Sprintf("%s %s", userName, UserNotFound)) + return nil, fmt.Errorf("%s %s", userName, UserNotFound) } else if len(allUsers) > 1 { - return nil, fmt.Errorf(fmt.Sprintf("multiple users named \"%s\" found", userName)) + return nil, fmt.Errorf("multiple users named \"%s\" found", userName) } return &allUsers[0], nil