Skip to content

Commit 7b917a0

Browse files
committed
[govet] Fix printf: non-constant format string in call to <func>
Signed-off-by: Martin Schuppert <[email protected]>
1 parent 9686bf0 commit 7b917a0

File tree

7 files changed

+14
-14
lines changed

7 files changed

+14
-14
lines changed

modules/common/condition/funcs.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ func (conditions *Conditions) Mirror(t Type) *Condition {
337337
cg := g[groupOrder(*TrueCondition(ReadyCondition, "foo"))]
338338
if len(cg.conditions) > 0 && cg.conditions.IsTrue(ReadyCondition) {
339339
c := cg.conditions.Get(ReadyCondition)
340-
mirrorCondition := TrueCondition(t, c.Message)
340+
mirrorCondition := TrueCondition(t, "%s", c.Message)
341341
mirrorCondition.LastTransitionTime = c.LastTransitionTime
342342

343343
return mirrorCondition
@@ -355,19 +355,19 @@ func (conditions *Conditions) Mirror(t Type) *Condition {
355355
c := (*cl)[0]
356356

357357
if c.Status == corev1.ConditionTrue {
358-
mirrorCondition = TrueCondition(t, c.Message)
358+
mirrorCondition = TrueCondition(t, "%s", c.Message)
359359
mirrorCondition.LastTransitionTime = c.LastTransitionTime
360360
break
361361
}
362362

363363
if c.Status == corev1.ConditionFalse {
364-
mirrorCondition = FalseCondition(t, c.Reason, c.Severity, c.Message)
364+
mirrorCondition = FalseCondition(t, c.Reason, c.Severity, "%s", c.Message)
365365
mirrorCondition.LastTransitionTime = c.LastTransitionTime
366366
break
367367
}
368368

369369
if c.Status == corev1.ConditionUnknown {
370-
mirrorCondition = UnknownCondition(t, c.Reason, c.Message)
370+
mirrorCondition = UnknownCondition(t, c.Reason, "%s", c.Message)
371371
mirrorCondition.LastTransitionTime = c.LastTransitionTime
372372
break
373373
}

modules/openstack/domain.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ func (o *OpenStack) CreateDomain(log logr.Logger, d Domain) (string, error) {
3838
}
3939
domainID = domain.ID
4040
} else {
41-
return domainID, fmt.Errorf(fmt.Sprintf("Multiple domains named \"%s\" found", d.Name))
41+
return domainID, fmt.Errorf("Multiple domains named \"%s\" found", d.Name)
4242
}
4343

4444
return domainID, nil

modules/openstack/limits.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ func (o *OpenStack) CreateLimit(
8686
}
8787
limitID = createdLimits[0].ID
8888
} else {
89-
return limitID, fmt.Errorf(fmt.Sprintf("multiple limits named \"%s\" found", l.ResourceName))
89+
return limitID, fmt.Errorf("multiple limits named \"%s\" found", l.ResourceName)
9090
}
9191

9292
return limitID, nil
@@ -156,7 +156,7 @@ func (o *OpenStack) CreateOrUpdateRegisteredLimit(
156156
}
157157
limitID = createdLimits[0].ID
158158
} else {
159-
return limitID, fmt.Errorf(fmt.Sprintf("multiple limits named \"%s\" found", l.ResourceName))
159+
return limitID, fmt.Errorf("multiple limits named \"%s\" found", l.ResourceName)
160160
}
161161

162162
return limitID, nil

modules/openstack/project.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ func (o *OpenStack) CreateProject(
6262
}
6363
projectID = project.ID
6464
} else {
65-
return projectID, fmt.Errorf(fmt.Sprintf("multiple projects named \"%s\" found", p.Name))
65+
return projectID, fmt.Errorf("multiple projects named \"%s\" found", p.Name)
6666
}
6767

6868
return projectID, nil
@@ -84,9 +84,9 @@ func (o *OpenStack) GetProject(
8484
}
8585

8686
if len(allProjects) == 0 {
87-
return nil, fmt.Errorf(fmt.Sprintf("%s %s", projectName, ProjectNotFound))
87+
return nil, fmt.Errorf("%s %s", projectName, ProjectNotFound)
8888
} else if len(allProjects) > 1 {
89-
return nil, fmt.Errorf(fmt.Sprintf("multiple project named \"%s\" found", projectName))
89+
return nil, fmt.Errorf("multiple project named \"%s\" found", projectName)
9090
}
9191

9292
return &allProjects[0], nil

modules/openstack/role.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ func (o *OpenStack) GetRole(
8080
}
8181

8282
if len(allRoles) == 0 {
83-
return nil, fmt.Errorf(fmt.Sprintf("%s %s", roleName, RoleNotFound))
83+
return nil, fmt.Errorf("%s %s", roleName, RoleNotFound)
8484
}
8585

8686
return &allRoles[0], nil

modules/openstack/service.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ func (o *OpenStack) GetService(
9696
}
9797

9898
if len(allServices) == 0 {
99-
return nil, fmt.Errorf(fmt.Sprintf("%s %s", serviceName, ServiceNotFound))
99+
return nil, fmt.Errorf("%s %s", serviceName, ServiceNotFound)
100100
}
101101

102102
return &allServices[0], nil

modules/openstack/user.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,9 @@ func (o *OpenStack) GetUser(
9494
}
9595

9696
if len(allUsers) == 0 {
97-
return nil, fmt.Errorf(fmt.Sprintf("%s %s", userName, UserNotFound))
97+
return nil, fmt.Errorf("%s %s", userName, UserNotFound)
9898
} else if len(allUsers) > 1 {
99-
return nil, fmt.Errorf(fmt.Sprintf("multiple users named \"%s\" found", userName))
99+
return nil, fmt.Errorf("multiple users named \"%s\" found", userName)
100100
}
101101

102102
return &allUsers[0], nil

0 commit comments

Comments
 (0)