diff --git a/coredns/gateway/controller.go b/coredns/gateway/controller.go index 61c86786..6e873cf7 100644 --- a/coredns/gateway/controller.go +++ b/coredns/gateway/controller.go @@ -20,7 +20,6 @@ package gateway import ( "context" - "fmt" "os" "sync/atomic" @@ -110,7 +109,7 @@ func (c *Controller) Start(client dynamic.Interface) error { go c.informer.Run(c.stopCh) if ok := cache.WaitForCacheSync(c.stopCh, c.informer.HasSynced); !ok { - return fmt.Errorf("failed to wait for informer cache to sync") + return errors.New("failed to wait for informer cache to sync") } go c.queue.Run(c.stopCh, c.processNextGateway) diff --git a/coredns/loadbalancer/smooth_weighted_round_robin.go b/coredns/loadbalancer/smooth_weighted_round_robin.go index a84b3162..1065f9e4 100644 --- a/coredns/loadbalancer/smooth_weighted_round_robin.go +++ b/coredns/loadbalancer/smooth_weighted_round_robin.go @@ -21,6 +21,7 @@ package loadbalancer import ( "fmt" + "github.com/pkg/errors" "github.com/submariner-io/admiral/pkg/log" logf "sigs.k8s.io/controller-runtime/pkg/log" ) @@ -67,7 +68,7 @@ func (lb *smoothWeightedRR) ItemCount() int { // Add - adds a new unique item to the list. func (lb *smoothWeightedRR) Add(item interface{}, weight int64) error { if item == nil { - return fmt.Errorf("item cannot be nil") + return errors.New("item cannot be nil") } if weight < 0 { diff --git a/pkg/agent/controller/controller_suite_test.go b/pkg/agent/controller/controller_suite_test.go index 2e575afa..b0e92ccf 100644 --- a/pkg/agent/controller/controller_suite_test.go +++ b/pkg/agent/controller/controller_suite_test.go @@ -534,7 +534,7 @@ func (c *cluster) awaitServiceExportCondition(expected ...*mcsv1a1.ServiceExport } return nil - }).ShouldNot(BeNil(), fmt.Sprintf("ServiceExport condition not received. Expected: %s", resource.ToJSON(expected[i]))) + }).ShouldNot(BeNil(), "ServiceExport condition not received. Expected: "+resource.ToJSON(expected[i])) } last := len(expected) - 1 @@ -551,7 +551,7 @@ func (c *cluster) awaitServiceExportCondition(expected ...*mcsv1a1.ServiceExport } return nil - }).ShouldNot(BeNil(), fmt.Sprintf("ServiceExport condition not found. Expected: %s", resource.ToJSON(expected[last]))) + }).ShouldNot(BeNil(), "ServiceExport condition not found. Expected: "+resource.ToJSON(expected[last])) for i := range expected { assertEquivalentConditions(actual[i], expected[i]) @@ -575,7 +575,7 @@ func (c *cluster) ensureLastServiceExportCondition(expected *mcsv1a1.ServiceExpo } } - Fail(fmt.Sprintf("ServiceExport condition not found. Expected: %s", resource.ToJSON(expected))) + Fail("ServiceExport condition not found. Expected: " + resource.ToJSON(expected)) return -1 } @@ -583,8 +583,7 @@ func (c *cluster) ensureLastServiceExportCondition(expected *mcsv1a1.ServiceExpo initialIndex := indexOfLastCondition() Consistently(func() int { return indexOfLastCondition() - }).Should(Equal(initialIndex), fmt.Sprintf("Expected ServiceExport condition to not change: %s", - resource.ToJSON(expected))) + }).Should(Equal(initialIndex), "Expected ServiceExport condition to not change: "+resource.ToJSON(expected)) } func (c *cluster) ensureNoServiceExportCondition(condType mcsv1a1.ServiceExportConditionType, serviceExports ...*mcsv1a1.ServiceExport) { diff --git a/test/e2e/framework/framework.go b/test/e2e/framework/framework.go index 94c21ce8..1cba9fc2 100644 --- a/test/e2e/framework/framework.go +++ b/test/e2e/framework/framework.go @@ -411,7 +411,7 @@ func (f *Framework) AwaitPodIngressIPs(targetCluster framework.ClusterIndex, svc ipList := make([]string, 0) for i := range len(podList.Items) { - ingressIPName := fmt.Sprintf("pod-%s", podList.Items[i].Name) + ingressIPName := "pod-" + podList.Items[i].Name ingressIP := f.Framework.AwaitGlobalIngressIP(targetCluster, ingressIPName, svc.Namespace) if isLocal { @@ -652,7 +652,7 @@ func (f *Framework) GetHealthCheckEnabledInfo(cluster framework.ClusterIndex) bo }, func(result interface{}) (bool, string, error) { unstructuredSubmarinerConfig := result.(*unstructured.Unstructured) - framework.By(fmt.Sprintf("Getting the Submariner Config, for cluster %s", framework.TestContext.ClusterIDs[cluster])) + framework.By("Getting the Submariner Config, for cluster " + framework.TestContext.ClusterIDs[cluster]) var found bool var err error