Skip to content

Commit 6edde10

Browse files
committed
correct error string according to golang best practice
1 parent 508a4f7 commit 6edde10

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

pkg/controller/controller_utils.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ var ExpKeyFunc = func(obj interface{}) (string, error) {
126126
if e, ok := obj.(*ControlleeExpectations); ok {
127127
return e.key, nil
128128
}
129-
return "", fmt.Errorf("Could not find key for obj %#v", obj)
129+
return "", fmt.Errorf("could not find key for obj %#v", obj)
130130
}
131131

132132
// ControllerExpectationsInterface is an interface that allows users to set and wait on expectations.
@@ -291,7 +291,7 @@ var UIDSetKeyFunc = func(obj interface{}) (string, error) {
291291
if u, ok := obj.(*UIDSet); ok {
292292
return u.key, nil
293293
}
294-
return "", fmt.Errorf("Could not find key for obj %#v", obj)
294+
return "", fmt.Errorf("could not find key for obj %#v", obj)
295295
}
296296

297297
// UIDSet holds a key and a set of UIDs. Used by the
@@ -627,7 +627,7 @@ func (f *FakePodControl) CreatePods(namespace string, spec *v1.PodTemplateSpec,
627627
defer f.Unlock()
628628
f.CreateCallCount++
629629
if f.CreateLimit != 0 && f.CreateCallCount > f.CreateLimit {
630-
return fmt.Errorf("Not creating pod, limit %d already reached (create call %d)", f.CreateLimit, f.CreateCallCount)
630+
return fmt.Errorf("not creating pod, limit %d already reached (create call %d)", f.CreateLimit, f.CreateCallCount)
631631
}
632632
f.Templates = append(f.Templates, *spec)
633633
if f.Err != nil {
@@ -641,7 +641,7 @@ func (f *FakePodControl) CreatePodsWithControllerRef(namespace string, spec *v1.
641641
defer f.Unlock()
642642
f.CreateCallCount++
643643
if f.CreateLimit != 0 && f.CreateCallCount > f.CreateLimit {
644-
return fmt.Errorf("Not creating pod, limit %d already reached (create call %d)", f.CreateLimit, f.CreateCallCount)
644+
return fmt.Errorf("not creating pod, limit %d already reached (create call %d)", f.CreateLimit, f.CreateCallCount)
645645
}
646646
f.Templates = append(f.Templates, *spec)
647647
f.ControllerRefs = append(f.ControllerRefs, *controllerRef)
@@ -656,7 +656,7 @@ func (f *FakePodControl) CreatePodsOnNode(nodeName, namespace string, template *
656656
defer f.Unlock()
657657
f.CreateCallCount++
658658
if f.CreateLimit != 0 && f.CreateCallCount > f.CreateLimit {
659-
return fmt.Errorf("Not creating pod, limit %d already reached (create call %d)", f.CreateLimit, f.CreateCallCount)
659+
return fmt.Errorf("not creating pod, limit %d already reached (create call %d)", f.CreateLimit, f.CreateCallCount)
660660
}
661661
f.Templates = append(f.Templates, *template)
662662
f.ControllerRefs = append(f.ControllerRefs, *controllerRef)
@@ -920,7 +920,7 @@ func AddOrUpdateTaintOnNode(c clientset.Interface, nodeName string, taints ...*v
920920
for _, taint := range taints {
921921
curNewNode, ok, err := taintutils.AddOrUpdateTaint(oldNodeCopy, taint)
922922
if err != nil {
923-
return fmt.Errorf("Failed to update taint of node!")
923+
return fmt.Errorf("failed to update taint of node")
924924
}
925925
updated = updated || ok
926926
newNode = curNewNode
@@ -977,7 +977,7 @@ func RemoveTaintOffNode(c clientset.Interface, nodeName string, node *v1.Node, t
977977
for _, taint := range taints {
978978
curNewNode, ok, err := taintutils.RemoveTaint(oldNodeCopy, taint)
979979
if err != nil {
980-
return fmt.Errorf("Failed to remove taint of node!")
980+
return fmt.Errorf("failed to remove taint of node")
981981
}
982982
updated = updated || ok
983983
newNode = curNewNode
@@ -1021,7 +1021,7 @@ func WaitForCacheSync(controllerName string, stopCh <-chan struct{}, cacheSyncs
10211021
klog.Infof("Waiting for caches to sync for %s controller", controllerName)
10221022

10231023
if !cache.WaitForCacheSync(stopCh, cacheSyncs...) {
1024-
utilruntime.HandleError(fmt.Errorf("Unable to sync caches for %s controller", controllerName))
1024+
utilruntime.HandleError(fmt.Errorf("unable to sync caches for %s controller", controllerName))
10251025
return false
10261026
}
10271027

0 commit comments

Comments
 (0)