Skip to content

Commit

Permalink
[govet] Fix printf: non-constant format string in call to <func>
Browse files Browse the repository at this point in the history
Signed-off-by: Martin Schuppert <[email protected]>
(cherry picked from commit 7b917a0)
  • Loading branch information
stuggi committed Sep 6, 2024
1 parent e5bbad6 commit d97f3e6
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 14 deletions.
8 changes: 4 additions & 4 deletions modules/common/condition/funcs.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion modules/openstack/domain.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions modules/openstack/limits.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions modules/openstack/project.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion modules/openstack/role.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion modules/openstack/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions modules/openstack/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit d97f3e6

Please sign in to comment.