diff --git a/brokerapi/broker/bind_test.go b/brokerapi/broker/bind_test.go index d02f4fd2e..48cf19cd8 100644 --- a/brokerapi/broker/bind_test.go +++ b/brokerapi/broker/bind_test.go @@ -3,6 +3,7 @@ package broker_test import ( "context" "encoding/json" + "errors" "fmt" "code.cloudfoundry.org/lager/v3" @@ -322,7 +323,7 @@ var _ = Describe("Bind", func() { const saveError = "credential-save-error" BeforeEach(func() { - fakeStorage.CreateServiceBindingCredentialsReturns(fmt.Errorf(saveError)) + fakeStorage.CreateServiceBindingCredentialsReturns(errors.New(saveError)) }) It("should error", func() { @@ -336,7 +337,7 @@ var _ = Describe("Bind", func() { const saveBindRequestError = "bind-request-save-error" BeforeEach(func() { - fakeStorage.StoreBindRequestDetailsReturns(fmt.Errorf(saveBindRequestError)) + fakeStorage.StoreBindRequestDetailsReturns(errors.New(saveBindRequestError)) }) It("should error", func() { @@ -350,7 +351,7 @@ var _ = Describe("Bind", func() { const credstoreError = "credstore-error" BeforeEach(func() { - fakeCredStore.PutReturns(nil, fmt.Errorf(credstoreError)) + fakeCredStore.PutReturns(nil, errors.New(credstoreError)) }) It("should error", func() { @@ -364,7 +365,7 @@ var _ = Describe("Bind", func() { const credstorePermissionError = "credstore-error-permissions" BeforeEach(func() { - fakeCredStore.AddPermissionReturns(nil, fmt.Errorf(credstorePermissionError)) + fakeCredStore.AddPermissionReturns(nil, errors.New(credstorePermissionError)) }) It("should error", func() { diff --git a/brokerapi/broker/unbind_test.go b/brokerapi/broker/unbind_test.go index 87c580660..c59b2b1bb 100644 --- a/brokerapi/broker/unbind_test.go +++ b/brokerapi/broker/unbind_test.go @@ -2,6 +2,7 @@ package broker_test import ( "context" + "errors" "fmt" "code.cloudfoundry.org/lager/v3" @@ -345,7 +346,7 @@ var _ = Describe("Unbind", func() { const deleteError = "credential-delete-error" BeforeEach(func() { - fakeStorage.DeleteServiceBindingCredentialsReturns(fmt.Errorf(deleteError)) + fakeStorage.DeleteServiceBindingCredentialsReturns(errors.New(deleteError)) }) It("should error", func() { @@ -359,7 +360,7 @@ var _ = Describe("Unbind", func() { const deleteError = "bind-details-delete-error" BeforeEach(func() { - fakeStorage.DeleteBindRequestDetailsReturns(fmt.Errorf(deleteError)) + fakeStorage.DeleteBindRequestDetailsReturns(errors.New(deleteError)) }) It("should error", func() { @@ -373,7 +374,7 @@ var _ = Describe("Unbind", func() { const deleteError = "bind-provider-details-delete-error" BeforeEach(func() { - fakeServiceProvider.DeleteBindingDataReturns(fmt.Errorf(deleteError)) + fakeServiceProvider.DeleteBindingDataReturns(errors.New(deleteError)) }) It("should error", func() { diff --git a/pkg/providers/tf/definition.go b/pkg/providers/tf/definition.go index 5d2140fc6..f1141ca31 100644 --- a/pkg/providers/tf/definition.go +++ b/pkg/providers/tf/definition.go @@ -205,7 +205,7 @@ func (tfb *TfServiceDefinitionV1) resolveEnvVars() (map[string]string, error) { for _, v := range tfb.RequiredEnvVars { _ = viper.BindEnv(v, v) if !viper.IsSet(v) { - return vars, fmt.Errorf(fmt.Sprintf("missing required env var %s", v)) + return vars, fmt.Errorf("missing required env var %s", v) } vars[v] = viper.GetString(v) } diff --git a/pkg/providers/tf/deprovision_test.go b/pkg/providers/tf/deprovision_test.go index feb2b9e69..e253e3b91 100644 --- a/pkg/providers/tf/deprovision_test.go +++ b/pkg/providers/tf/deprovision_test.go @@ -2,6 +2,7 @@ package tf_test import ( "context" + "errors" "fmt" "github.com/hashicorp/go-version" @@ -99,7 +100,7 @@ var _ = Describe("Deprovision", func() { }) It("fails, when unable to update the workspace HCL", func() { - fakeDeploymentManager.UpdateWorkspaceHCLReturns(fmt.Errorf(expectedError)) + fakeDeploymentManager.UpdateWorkspaceHCLReturns(errors.New(expectedError)) provider := tf.NewTerraformProvider( executor.TFBinariesContext{DefaultTfVersion: version.Must(version.NewVersion("1.6.0"))}, @@ -116,7 +117,7 @@ var _ = Describe("Deprovision", func() { }) It("fails, when unable to get the Terraform deployment", func() { - fakeDeploymentManager.GetTerraformDeploymentReturns(storage.TerraformDeployment{}, fmt.Errorf(expectedError)) + fakeDeploymentManager.GetTerraformDeploymentReturns(storage.TerraformDeployment{}, errors.New(expectedError)) provider := tf.NewTerraformProvider( executor.TFBinariesContext{}, @@ -134,7 +135,7 @@ var _ = Describe("Deprovision", func() { It("fails, when unable to mark operation as started", func() { fakeDeploymentManager.GetTerraformDeploymentReturns(deployment, nil) - fakeDeploymentManager.MarkOperationStartedReturns(fmt.Errorf(expectedError)) + fakeDeploymentManager.MarkOperationStartedReturns(errors.New(expectedError)) provider := tf.NewTerraformProvider( executor.TFBinariesContext{}, @@ -154,7 +155,7 @@ var _ = Describe("Deprovision", func() { fakeDeploymentManager.GetTerraformDeploymentReturns(deployment, nil) fakeDeploymentManager.MarkOperationStartedReturns(nil) fakeInvokerBuilder.VersionedTerraformInvokerReturns(fakeDefaultInvoker) - fakeDefaultInvoker.DestroyReturns(fmt.Errorf(expectedError)) + fakeDefaultInvoker.DestroyReturns(errors.New(expectedError)) provider := tf.NewTerraformProvider( executor.TFBinariesContext{DefaultTfVersion: version.Must(version.NewVersion("1.6.0"))}, diff --git a/pkg/providers/tf/unbind_test.go b/pkg/providers/tf/unbind_test.go index 0ac10fb09..ed24c5bec 100644 --- a/pkg/providers/tf/unbind_test.go +++ b/pkg/providers/tf/unbind_test.go @@ -2,6 +2,7 @@ package tf_test import ( "context" + "errors" "fmt" "github.com/hashicorp/go-version" @@ -108,7 +109,7 @@ var _ = Describe("Unbind", func() { }) It("fails, when unable to update the workspace HCL", func() { - fakeDeploymentManager.UpdateWorkspaceHCLReturns(fmt.Errorf(expectedError)) + fakeDeploymentManager.UpdateWorkspaceHCLReturns(errors.New(expectedError)) provider := tf.NewTerraformProvider(executor.TFBinariesContext{DefaultTfVersion: version.Must(version.NewVersion("1"))}, fakeInvokerBuilder, fakeLogger, fakeServiceDefinition, fakeDeploymentManager) @@ -117,7 +118,7 @@ var _ = Describe("Unbind", func() { }) It("fails, when unable to get the Terraform deployment", func() { - fakeDeploymentManager.GetTerraformDeploymentReturns(storage.TerraformDeployment{}, fmt.Errorf(expectedError)) + fakeDeploymentManager.GetTerraformDeploymentReturns(storage.TerraformDeployment{}, errors.New(expectedError)) provider := tf.NewTerraformProvider(executor.TFBinariesContext{}, fakeInvokerBuilder, fakeLogger, fakeServiceDefinition, fakeDeploymentManager) @@ -127,7 +128,7 @@ var _ = Describe("Unbind", func() { It("fails, when unable to mark operation as started", func() { fakeDeploymentManager.GetTerraformDeploymentReturns(deployment, nil) - fakeDeploymentManager.MarkOperationStartedReturns(fmt.Errorf(expectedError)) + fakeDeploymentManager.MarkOperationStartedReturns(errors.New(expectedError)) provider := tf.NewTerraformProvider(executor.TFBinariesContext{}, fakeInvokerBuilder, fakeLogger, fakeServiceDefinition, fakeDeploymentManager) @@ -139,8 +140,8 @@ var _ = Describe("Unbind", func() { fakeDeploymentManager.GetTerraformDeploymentReturns(deployment, nil) fakeDeploymentManager.MarkOperationStartedReturns(nil) fakeInvokerBuilder.VersionedTerraformInvokerReturns(fakeDefaultInvoker) - fakeDefaultInvoker.DestroyReturns(fmt.Errorf(expectedError)) - fakeDeploymentManager.OperationStatusReturns(true, "", fmt.Errorf(expectedError)) + fakeDefaultInvoker.DestroyReturns(errors.New(expectedError)) + fakeDeploymentManager.OperationStatusReturns(true, "", errors.New(expectedError)) provider := tf.NewTerraformProvider(executor.TFBinariesContext{DefaultTfVersion: version.Must(version.NewVersion("1"))}, fakeInvokerBuilder, fakeLogger, fakeServiceDefinition, fakeDeploymentManager)