diff --git a/internal/provider/namespace_data_source.go b/internal/provider/namespace_data_source.go index 965d436..2ced3f2 100644 --- a/internal/provider/namespace_data_source.go +++ b/internal/provider/namespace_data_source.go @@ -151,8 +151,7 @@ func (d *NamespaceDataSource) Read(ctx context.Context, req datasource.ReadReque tflog.Trace(ctx, "read a data source") - var data *NamespaceDataSourceModel - data = &NamespaceDataSourceModel{ + data := &NamespaceDataSourceModel{ Name: types.StringValue(ns.NamespaceInfo.GetName()), Id: types.StringValue(ns.NamespaceInfo.GetId()), Description: types.StringValue(ns.NamespaceInfo.GetDescription()), diff --git a/internal/provider/namespace_resource.go b/internal/provider/namespace_resource.go index e6dc4ed..4edef88 100644 --- a/internal/provider/namespace_resource.go +++ b/internal/provider/namespace_resource.go @@ -197,10 +197,9 @@ func (r *NamespaceResource) Create(ctx context.Context, req resource.CreateReque if _, ok := err.(*serviceerror.NamespaceAlreadyExists); !ok { resp.Diagnostics.AddError("Request error", "namespace registration failed: "+err.Error()) return - } else { - resp.Diagnostics.AddError(data.Name.ValueString(), "namespace is already registered: "+err.Error()) - return } + resp.Diagnostics.AddError(data.Name.ValueString(), "namespace is already registered: "+err.Error()) + return } tflog.Info(ctx, fmt.Sprintf("The namespace: %s is successfully registered", data.Name))