From 958c743a6a53284fb8ad3e1444487c692f05554c Mon Sep 17 00:00:00 2001 From: Mickael Stanislas Date: Mon, 23 Oct 2023 10:09:33 +0200 Subject: [PATCH] fix: lint goconst (#37) --- base.go | 4 ++++ list_value_test.go | 4 ++-- map_value_test.go | 4 ++-- set_value_test.go | 4 ++-- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/base.go b/base.go index abfd8e7..b61986f 100644 --- a/base.go +++ b/base.go @@ -6,4 +6,8 @@ import ( _ "github.com/iancoleman/strcase" ) +const ( + errorTest = "An unexpected error was encountered trying to validate an attribute value. This is always an error in the provider. Please report the following to the provider developer:\n\n" +) + //go:generate go run template.go diff --git a/list_value_test.go b/list_value_test.go index e432286..e2f251d 100644 --- a/list_value_test.go +++ b/list_value_test.go @@ -162,7 +162,7 @@ func TestNewListValueFrom(t *testing.T) { diag.NewAttributeErrorDiagnostic( path.Empty(), "List Type Validation Error", - "An unexpected error was encountered trying to validate an attribute value. This is always an error in the provider. Please report the following to the provider developer:\n\n"+ + errorTest+ "expected List value, received tftypes.Value with value: tftypes.String<\"oops\">", ), }, @@ -774,7 +774,7 @@ func TestListTypeValidate(t *testing.T) { diag.NewAttributeErrorDiagnostic( path.Root("test"), "List Type Validation Error", - "An unexpected error was encountered trying to validate an attribute value. This is always an error in the provider. Please report the following to the provider developer:\n\n"+ + errorTest+ "expected List value, received tftypes.Value with value: tftypes.Set[tftypes.String]>", ), }, diff --git a/map_value_test.go b/map_value_test.go index a048b56..6d11aa4 100644 --- a/map_value_test.go +++ b/map_value_test.go @@ -160,7 +160,7 @@ func TestNewMapValueFrom(t *testing.T) { diag.NewAttributeErrorDiagnostic( path.Empty(), "Map Type Validation Error", - "An unexpected error was encountered trying to validate an attribute value. This is always an error in the provider. Please report the following to the provider developer:\n\n"+ + errorTest+ "expected Map value, received tftypes.Value with value: tftypes.String<\"oops\">", ), }, @@ -853,7 +853,7 @@ func TestMapTypeValidate(t *testing.T) { diag.NewAttributeErrorDiagnostic( path.Root("test"), "Map Type Validation Error", - "An unexpected error was encountered trying to validate an attribute value. This is always an error in the provider. Please report the following to the provider developer:\n\n"+ + errorTest+ "expected Map value, received tftypes.Value with value: tftypes.List[tftypes.String]>", ), }, diff --git a/set_value_test.go b/set_value_test.go index a0a2ae6..c587f75 100644 --- a/set_value_test.go +++ b/set_value_test.go @@ -274,7 +274,7 @@ package supertypes // diag.NewAttributeErrorDiagnostic( // path.Root("test"), // "Set Type Validation Error", -// "An unexpected error was encountered trying to validate an attribute value. This is always an error in the provider. Please report the following to the provider developer:\n\n"+ +// errorTest + // "expected Set value, received tftypes.Value with value: tftypes.List[tftypes.String]>", // ), // }, @@ -442,7 +442,7 @@ package supertypes // diag.NewAttributeErrorDiagnostic( // path.Empty(), // "Set Type Validation Error", -// "An unexpected error was encountered trying to validate an attribute value. This is always an error in the provider. Please report the following to the provider developer:\n\n"+ +// errorTest + // "expected Set value, received tftypes.Value with value: tftypes.String<\"oops\">", // ), // },