From 84eb538acac9627acd51aeed711681a05b5ae10a Mon Sep 17 00:00:00 2001 From: Edward Park Date: Tue, 24 Oct 2023 20:41:23 -0700 Subject: [PATCH] lint --- internal/provider/resources/workspace_role.go | 8 ++++---- internal/provider/resources/workspace_role_test.go | 1 - internal/testutils/provider.go | 2 +- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/internal/provider/resources/workspace_role.go b/internal/provider/resources/workspace_role.go index 0d52db44..dbd3cbf4 100644 --- a/internal/provider/resources/workspace_role.go +++ b/internal/provider/resources/workspace_role.go @@ -122,7 +122,7 @@ func (r *WorkspaceRoleResource) Schema(_ context.Context, _ resource.SchemaReque } // copyWorkspaceRoleToModel copies an api.WorkspaceRole to a WorkspaceRoleDataSourceModel. -func copyWorkspaceRoleToModel(ctx context.Context, role *api.WorkspaceRole, model *WorkspaceRoleResourceModel) diag.Diagnostics { +func copyWorkspaceRoleToModel(_ context.Context, role *api.WorkspaceRole, model *WorkspaceRoleResourceModel) diag.Diagnostics { model.ID = types.StringValue(role.ID.String()) model.Created = customtypes.NewTimestampPointerValue(role.Created) model.Updated = customtypes.NewTimestampPointerValue(role.Updated) @@ -134,11 +134,12 @@ func copyWorkspaceRoleToModel(ctx context.Context, role *api.WorkspaceRole, mode // NOTE: here, we'll omit updating the TF state with the scopes returned from the API // as scopes in Prefect Cloud have a hierarchical structure. This means that children scopes - // can be returned based on what a practioner configures in TF / HCL, which will cause + // can be returned based on what a practitioner configures in TF / HCL, which will cause // conflicts on apply, as the retrieved state from the API will vary slightly with // the Terraform configuration. Therefore, the state will hold the user-defined scope parameters, // which will include any children scopes on the Prefect Cloud side. + //nolint:gocritic // scopes, diags := types.ListValueFrom(ctx, types.StringType, role.Scopes) // if diags.HasError() { // return diags @@ -209,7 +210,6 @@ func (r *WorkspaceRoleResource) Read(ctx context.Context, req resource.ReadReque return } - // client, err := r.client.ServiceAccounts(model.AccountID.ValueUUID()) client, err := r.client.WorkspaceRoles(model.AccountID.ValueUUID()) if err != nil { resp.Diagnostics.AddError( @@ -368,7 +368,7 @@ func (r *WorkspaceRoleResource) Delete(ctx context.Context, req resource.DeleteR } } -// ImportState allows Terraform to start managing a Workspace Role resource +// ImportState allows Terraform to start managing a Workspace Role resource. func (r *WorkspaceRoleResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { // Retrieve import ID and save to id attribute resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp) diff --git a/internal/provider/resources/workspace_role_test.go b/internal/provider/resources/workspace_role_test.go index ad73d68b..40116e71 100644 --- a/internal/provider/resources/workspace_role_test.go +++ b/internal/provider/resources/workspace_role_test.go @@ -41,7 +41,6 @@ func TestAccResource_workspace_role(t *testing.T) { }, }, }) - } func fixtureAccWorkspaceRoleResource(name string) string { diff --git a/internal/testutils/provider.go b/internal/testutils/provider.go index 7407f10a..d89b126b 100644 --- a/internal/testutils/provider.go +++ b/internal/testutils/provider.go @@ -20,7 +20,7 @@ provider "prefect" {} // acceptance testing. The factory function will be invoked for every Terraform // CLI command executed to create a provider server to which the CLI can // reattach. -var TestAccProvider = providerserver.NewProtocol6WithError(provider.New()) var TestAccProtoV6ProviderFactories = map[string]func() (tfprotov6.ProviderServer, error){ "prefect": TestAccProvider, } +var TestAccProvider = providerserver.NewProtocol6WithError(provider.New())