diff --git a/go.mod b/go.mod index 04a5ded..8ffdd80 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.21 require ( github.com/Yamashou/gqlgenc v0.14.0 - github.com/golangci/golangci-lint v1.55.2 + github.com/golangci/golangci-lint v1.55.1 github.com/hashicorp/terraform-plugin-docs v0.16.0 github.com/hashicorp/terraform-plugin-framework v1.4.2 github.com/hashicorp/terraform-plugin-framework-validators v0.12.0 diff --git a/go.sum b/go.sum index f3e8762..af0c799 100644 --- a/go.sum +++ b/go.sum @@ -428,8 +428,8 @@ github.com/golangci/go-misc v0.0.0-20220329215616-d24fe342adfe h1:6RGUuS7EGotKx6 github.com/golangci/go-misc v0.0.0-20220329215616-d24fe342adfe/go.mod h1:gjqyPShc/m8pEMpk0a3SeagVb0kaqvhscv+i9jI5ZhQ= github.com/golangci/gofmt v0.0.0-20231018234816-f50ced29576e h1:ULcKCDV1LOZPFxGZaA6TlQbiM3J2GCPnkx/bGF6sX/g= github.com/golangci/gofmt v0.0.0-20231018234816-f50ced29576e/go.mod h1:Pm5KhLPA8gSnQwrQ6ukebRcapGb/BG9iUkdaiCcGHJM= -github.com/golangci/golangci-lint v1.55.2 h1:yllEIsSJ7MtlDBwDJ9IMBkyEUz2fYE0b5B8IUgO1oP8= -github.com/golangci/golangci-lint v1.55.2/go.mod h1:H60CZ0fuqoTwlTvnbyjhpZPWp7KmsjwV2yupIMiMXbM= +github.com/golangci/golangci-lint v1.55.1 h1:DL2j9Eeapg1N3WEkKnQFX5L40SYtjZZJjGVdyEgNrDc= +github.com/golangci/golangci-lint v1.55.1/go.mod h1:z00biPRqjo5MISKV1+RWgONf2KvrPDmfqxHpHKB6bI4= github.com/golangci/lint-1 v0.0.0-20191013205115-297bf364a8e0 h1:MfyDlzVjl1hoaPzPD4Gpb/QgoRfSBR0jdhwGyAWwMSA= github.com/golangci/lint-1 v0.0.0-20191013205115-297bf364a8e0/go.mod h1:66R6K6P6VWk9I95jvqGxkqJxVWGFy9XlDwLwVz1RCFg= github.com/golangci/maligned v0.0.0-20180506175553-b1d89398deca h1:kNY3/svz5T29MYHubXix4aDDuE3RWHkPvopM/EDv/MA= diff --git a/internal/datasource/cluster.go b/internal/datasource/cluster.go index faf47cd..06d0cbb 100644 --- a/internal/datasource/cluster.go +++ b/internal/datasource/cluster.go @@ -202,7 +202,7 @@ func (d *clusterDataSource) Read(ctx context.Context, req datasource.ReadRequest } if cluster == nil { - resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Unable to read cluster, see warnings for more information")) + resp.Diagnostics.AddError("Client Error", "Unable to read cluster, see warnings for more information") return } diff --git a/internal/datasource/git_repository.go b/internal/datasource/git_repository.go index 718c70f..029c4d6 100644 --- a/internal/datasource/git_repository.go +++ b/internal/datasource/git_repository.go @@ -83,7 +83,7 @@ func (r *GitRepositoryDataSource) Read(ctx context.Context, req datasource.ReadR } if response == nil || response.GitRepository == nil { - resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Unable to find GitRepository")) + resp.Diagnostics.AddError("Client Error", "Unable to find GitRepository") return } diff --git a/internal/datasource/provider.go b/internal/datasource/provider.go index 591c161..5d38cb7 100644 --- a/internal/datasource/provider.go +++ b/internal/datasource/provider.go @@ -113,7 +113,7 @@ func (p *providerDataSource) Read(ctx context.Context, req datasource.ReadReques return } if result == nil && result.ClusterProvider == nil { - resp.Diagnostics.AddError("Not Found", fmt.Sprintf("Unable to find provider")) + resp.Diagnostics.AddError("Not Found", "Unable to find provider") return } diff --git a/internal/defaults/env.go b/internal/defaults/env.go index 292389c..11b1a54 100644 --- a/internal/defaults/env.go +++ b/internal/defaults/env.go @@ -2,7 +2,6 @@ package defaults import ( "context" - "fmt" "os" "github.com/hashicorp/terraform-plugin-framework/resource/schema/defaults" @@ -31,11 +30,11 @@ type envDefaultValue[T defaultable] struct { } func (d envDefaultValue[_]) Description(_ context.Context) string { - return fmt.Sprintf("If value is not configured, defaults to a representation of the provided env variable") + return "If value is not configured, defaults to a representation of the provided env variable" } func (d envDefaultValue[_]) MarkdownDescription(_ context.Context) string { - return fmt.Sprintf("If value is not configured, defaults to a representation of the provided env variable") + return "If value is not configured, defaults to a representation of the provided env variable" } func (d envDefaultValue[T]) DefaultString(_ context.Context, _ defaults.StringRequest, resp *defaults.StringResponse) { @@ -44,7 +43,8 @@ func (d envDefaultValue[T]) DefaultString(_ context.Context, _ defaults.StringRe value = v } - resp.PlanValue = types.StringValue(value.(string)) + stringValue, _ := value.(string) + resp.PlanValue = types.StringValue(stringValue) } func (d envDefaultValue[T]) DefaultBool(_ context.Context, _ defaults.BoolRequest, resp *defaults.BoolResponse) { @@ -53,5 +53,6 @@ func (d envDefaultValue[T]) DefaultBool(_ context.Context, _ defaults.BoolReques value = v == "true" } - resp.PlanValue = types.BoolValue(value.(bool)) + boolValue, _ := value.(bool) + resp.PlanValue = types.BoolValue(boolValue) } diff --git a/internal/resource/cluster/cluster.go b/internal/resource/cluster/cluster.go index 9f723b7..7d5f1a5 100644 --- a/internal/resource/cluster/cluster.go +++ b/internal/resource/cluster/cluster.go @@ -32,9 +32,8 @@ func NewClusterResource() resource.Resource { // ClusterResource defines the cluster resource implementation. type clusterResource struct { - client *client.Client - consoleUrl string - operatorHandler *OperatorHandler + client *client.Client + consoleUrl string } func (r *clusterResource) Metadata(_ context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse) { @@ -308,7 +307,7 @@ func (r *clusterResource) Create(ctx context.Context, req resource.CreateRequest if common.IsCloud(data.Cloud.ValueString(), common.CloudBYOK) { if result.CreateCluster.DeployToken == nil { - resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Unable to fetch cluster deploy token")) + resp.Diagnostics.AddError("Client Error", "Unable to fetch cluster deploy token") return } @@ -342,7 +341,7 @@ func (r *clusterResource) Read(ctx context.Context, req resource.ReadRequest, re return } if result == nil || result.Cluster == nil { - resp.Diagnostics.AddError("Not Found", fmt.Sprintf("Unable to find cluster, it looks like it was deleted manually")) + resp.Diagnostics.AddError("Not Found", "Unable to find cluster, it looks like it was deleted manually") return } diff --git a/internal/resource/git_repository.go b/internal/resource/git_repository.go index 3ca4c91..3f0c6ef 100644 --- a/internal/resource/git_repository.go +++ b/internal/resource/git_repository.go @@ -167,7 +167,7 @@ func (r *GitRepositoryResource) Read(ctx context.Context, req resource.ReadReque } if response == nil || response.GitRepository == nil { - resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Unable to find GitRepository")) + resp.Diagnostics.AddError("Client Error", "Unable to find GitRepository") return } diff --git a/internal/resource/provider.go b/internal/resource/provider.go index a2f3e5f..8655f76 100644 --- a/internal/resource/provider.go +++ b/internal/resource/provider.go @@ -213,7 +213,7 @@ func (r *providerResource) Read(ctx context.Context, req resource.ReadRequest, r return } if result == nil || result.ClusterProvider == nil { - resp.Diagnostics.AddError("Not Found", fmt.Sprintf("Unable to find provider, it looks like it was deleted manually")) + resp.Diagnostics.AddError("Not Found", "Unable to find provider, it looks like it was deleted manually") return } diff --git a/internal/validator/also_requires_if.go b/internal/validator/also_requires_if.go index 5e3280e..4180e28 100644 --- a/internal/validator/also_requires_if.go +++ b/internal/validator/also_requires_if.go @@ -117,7 +117,7 @@ func (a alsoRequiresIfValidator) ValidateString(ctx context.Context, req validat resp.Diagnostics.Append(validateResp.Diagnostics...) } -// AlsoRequiresIf todo +// AlsoRequiresIf todo. func AlsoRequiresIf(f RequiresIf, expressions ...path.Expression) validator.String { return &alsoRequiresIfValidator{ PathExpressions: expressions,