From 1056180ca571ef171870be5e864461fb49732bdf Mon Sep 17 00:00:00 2001 From: Pavel Boldyrev <627562+bpg@users.noreply.github.com> Date: Mon, 23 Oct 2023 18:41:26 -0400 Subject: [PATCH] chore: fix linter error (#645) Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com> --- fwprovider/datasource_hagroup.go | 2 +- fwprovider/datasource_hagroups.go | 2 +- fwprovider/datasource_haresource.go | 5 ++--- fwprovider/datasource_haresources.go | 2 +- fwprovider/datasource_version.go | 2 +- fwprovider/resource_hagroup.go | 2 +- fwprovider/resource_haresource.go | 15 +++++---------- fwprovider/resource_linux_bridge.go | 3 +-- fwprovider/resource_linux_vlan.go | 3 +-- fwprovider/resource_options.go | 3 +-- proxmoxtf/test/utils.go | 2 +- utils/io_test.go | 4 ++-- 12 files changed, 18 insertions(+), 27 deletions(-) diff --git a/fwprovider/datasource_hagroup.go b/fwprovider/datasource_hagroup.go index 0de3b687..3ffd97c8 100644 --- a/fwprovider/datasource_hagroup.go +++ b/fwprovider/datasource_hagroup.go @@ -93,7 +93,7 @@ func (d *haGroupDatasource) Configure( if !ok { resp.Diagnostics.AddError( "Unexpected Resource Configure Type", - fmt.Sprintf("Expected *proxmox.Client, got: %T. Please report this issue to the provider developers.", + fmt.Sprintf("Expected *proxmox.Client, got: %T", req.ProviderData), ) diff --git a/fwprovider/datasource_hagroups.go b/fwprovider/datasource_hagroups.go index 0f8792c9..9b2e55c1 100644 --- a/fwprovider/datasource_hagroups.go +++ b/fwprovider/datasource_hagroups.go @@ -81,7 +81,7 @@ func (d *haGroupsDatasource) Configure( if !ok { resp.Diagnostics.AddError( "Unexpected Resource Configure Type", - fmt.Sprintf("Expected *proxmox.Client, got: %T. Please report this issue to the provider developers.", + fmt.Sprintf("Expected *proxmox.Client, got: %T", req.ProviderData), ) diff --git a/fwprovider/datasource_haresource.go b/fwprovider/datasource_haresource.go index b6d68848..02b869ce 100644 --- a/fwprovider/datasource_haresource.go +++ b/fwprovider/datasource_haresource.go @@ -104,7 +104,7 @@ func (d *haResourceDatasource) Configure( } else { resp.Diagnostics.AddError( "Unexpected Resource Configure Type", - fmt.Sprintf("Expected *proxmox.Client, got: %T. Please report this issue to the provider developers.", + fmt.Sprintf("Expected *proxmox.Client, got: %T", req.ProviderData), ) } @@ -124,8 +124,7 @@ func (d *haResourceDatasource) Read(ctx context.Context, req datasource.ReadRequ if err != nil { resp.Diagnostics.AddError( "Unexpected error parsing Proxmox HA resource identifier", - fmt.Sprintf("Couldn't parse configuration into a valid HA resource identifier: %s. "+ - "Please report this issue to the provider developers.", err.Error()), + fmt.Sprintf("Couldn't parse configuration into a valid HA resource identifier: %ss", err.Error()), ) return diff --git a/fwprovider/datasource_haresources.go b/fwprovider/datasource_haresources.go index d0386113..44f29552 100644 --- a/fwprovider/datasource_haresources.go +++ b/fwprovider/datasource_haresources.go @@ -98,7 +98,7 @@ func (d *haResourcesDatasource) Configure( } else { resp.Diagnostics.AddError( "Unexpected Resource Configure Type", - fmt.Sprintf("Expected *proxmox.Client, got: %T. Please report this issue to the provider developers.", + fmt.Sprintf("Expected *proxmox.Client, got: %T", req.ProviderData), ) } diff --git a/fwprovider/datasource_version.go b/fwprovider/datasource_version.go index 58912849..bc6bd190 100644 --- a/fwprovider/datasource_version.go +++ b/fwprovider/datasource_version.go @@ -90,7 +90,7 @@ func (d *versionDatasource) Configure( if !ok { resp.Diagnostics.AddError( "Unexpected Resource Configure Type", - fmt.Sprintf("Expected *proxmox.Client, got: %T. Please report this issue to the provider developers.", + fmt.Sprintf("Expected *proxmox.Client, got: %T", req.ProviderData), ) diff --git a/fwprovider/resource_hagroup.go b/fwprovider/resource_hagroup.go index d300dc50..20ef1f7c 100644 --- a/fwprovider/resource_hagroup.go +++ b/fwprovider/resource_hagroup.go @@ -136,7 +136,7 @@ func (r *hagroupResource) Configure( } else { resp.Diagnostics.AddError( "Unexpected Resource Configure Type", - fmt.Sprintf("Expected *proxmox.Client, got: %T. Please report this issue to the provider developers.", + fmt.Sprintf("Expected *proxmox.Client, got: %T", req.ProviderData), ) } diff --git a/fwprovider/resource_haresource.go b/fwprovider/resource_haresource.go index c64c9ea7..aaee1ea7 100644 --- a/fwprovider/resource_haresource.go +++ b/fwprovider/resource_haresource.go @@ -151,8 +151,7 @@ func (r *haResourceResource) Configure( } else { resp.Diagnostics.AddError( "Unexpected Resource Configure Type", - fmt.Sprintf("Expected *proxmox.Client, got: %T. Please report this issue to the provider developers.", - req.ProviderData), + fmt.Sprintf("Expected *proxmox.Client, got: %T", req.ProviderData), ) } } @@ -171,8 +170,7 @@ func (r *haResourceResource) Create(ctx context.Context, req resource.CreateRequ if err != nil { resp.Diagnostics.AddError( "Unexpected error parsing Proxmox HA resource identifier", - fmt.Sprintf("Couldn't parse the Terraform resource ID into a valid HA resource identifier: %s. "+ - "Please report this issue to the provider developers.", err), + fmt.Sprintf("Couldn't parse the Terraform resource ID into a valid HA resource identifier: %s", err), ) return @@ -214,8 +212,7 @@ func (r *haResourceResource) Update( if err != nil { resp.Diagnostics.AddError( "Unexpected error parsing Proxmox HA resource identifier", - fmt.Sprintf("Couldn't parse the Terraform resource ID into a valid HA resource identifier: %s. "+ - "Please report this issue to the provider developers.", err), + fmt.Sprintf("Couldn't parse the Terraform resource ID into a valid HA resource identifier: %s", err), ) return @@ -253,8 +250,7 @@ func (r *haResourceResource) Delete( if err != nil { resp.Diagnostics.AddError( "Unexpected error parsing Proxmox HA resource identifier", - fmt.Sprintf("Couldn't parse the Terraform resource ID into a valid HA resource identifier: %s. "+ - "Please report this issue to the provider developers.", err), + fmt.Sprintf("Couldn't parse the Terraform resource ID into a valid HA resource identifier: %s", err), ) return @@ -329,8 +325,7 @@ func (r *haResourceResource) read(ctx context.Context, data *haResourceModel) (b if err != nil { diags.AddError( "Unexpected error parsing Proxmox HA resource identifier", - fmt.Sprintf("Couldn't parse the Terraform resource ID into a valid HA resource identifier: %s. "+ - "Please report this issue to the provider developers.", err), + fmt.Sprintf("Couldn't parse the Terraform resource ID into a valid HA resource identifier: %s", err), ) return false, diags diff --git a/fwprovider/resource_linux_bridge.go b/fwprovider/resource_linux_bridge.go index 7bdb214a..1dd93b8c 100644 --- a/fwprovider/resource_linux_bridge.go +++ b/fwprovider/resource_linux_bridge.go @@ -254,8 +254,7 @@ func (r *linuxBridgeResource) Configure( if !ok { resp.Diagnostics.AddError( "Unexpected Resource Configure Type", - fmt.Sprintf("Expected *proxmox.Client, got: %T. Please report this issue to the provider developers.", - req.ProviderData), + fmt.Sprintf("Expected *proxmox.Client, got: %T", req.ProviderData), ) return diff --git a/fwprovider/resource_linux_vlan.go b/fwprovider/resource_linux_vlan.go index a1fae531..7615786a 100644 --- a/fwprovider/resource_linux_vlan.go +++ b/fwprovider/resource_linux_vlan.go @@ -228,8 +228,7 @@ func (r *linuxVLANResource) Configure( if !ok { resp.Diagnostics.AddError( "Unexpected Resource Configure Type", - fmt.Sprintf("Expected *proxmox.Client, got: %T. Please report this issue to the provider developers.", - req.ProviderData), + fmt.Sprintf("Expected *proxmox.Client, got: %T", req.ProviderData), ) return diff --git a/fwprovider/resource_options.go b/fwprovider/resource_options.go index 0be53942..8ed001b6 100644 --- a/fwprovider/resource_options.go +++ b/fwprovider/resource_options.go @@ -464,8 +464,7 @@ func (r *clusterOptionsResource) Configure( if !ok { resp.Diagnostics.AddError( "Unexpected Resource Configure Type", - fmt.Sprintf("Expected *proxmox.Client, got: %T. Please report this issue to the provider developers.", - req.ProviderData), + fmt.Sprintf("Expected *proxmox.Client, got: %T", req.ProviderData), ) return diff --git a/proxmoxtf/test/utils.go b/proxmoxtf/test/utils.go index 9d1b2961..ab4bb89b 100644 --- a/proxmoxtf/test/utils.go +++ b/proxmoxtf/test/utils.go @@ -44,7 +44,7 @@ func AssertListMaxItems(t *testing.T, s *schema.Resource, key string, expectedMa t.Helper() require.NotNil(t, s.Schema[key], "Error in Schema: Missing definition for \"%s\"", key) - assert.Equal(t, s.Schema[key].MaxItems, expectedMaxItems, + assert.Equal(t, expectedMaxItems, s.Schema[key].MaxItems, "Error in Schema: Argument \"%s\" has \"MaxItems: %#v\", but value %#v is expected!", key, s.Schema[key].MaxItems, expectedMaxItems) } diff --git a/utils/io_test.go b/utils/io_test.go index 268e020d..c6fb87d6 100644 --- a/utils/io_test.go +++ b/utils/io_test.go @@ -25,10 +25,10 @@ func TestCloseOrLogError(t *testing.T) { func() { defer f(c) defer f(b) - assert.Equal(t, false, c.isClosed) + assert.False(t, c.isClosed) }() - assert.Equal(t, true, c.isClosed) + assert.True(t, c.isClosed) } type testCloser struct {