Skip to content

Commit

Permalink
fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
floreks committed Dec 5, 2023
1 parent da71755 commit 3dd576d
Show file tree
Hide file tree
Showing 10 changed files with 19 additions and 19 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down
2 changes: 1 addition & 1 deletion internal/datasource/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
2 changes: 1 addition & 1 deletion internal/datasource/git_repository.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
2 changes: 1 addition & 1 deletion internal/datasource/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
11 changes: 6 additions & 5 deletions internal/defaults/env.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package defaults

import (
"context"
"fmt"
"os"

"github.com/hashicorp/terraform-plugin-framework/resource/schema/defaults"
Expand Down Expand Up @@ -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) {
Expand All @@ -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) {
Expand All @@ -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)
}
9 changes: 4 additions & 5 deletions internal/resource/cluster/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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
}

Expand Down Expand Up @@ -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
}

Expand Down
2 changes: 1 addition & 1 deletion internal/resource/git_repository.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
2 changes: 1 addition & 1 deletion internal/resource/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
2 changes: 1 addition & 1 deletion internal/validator/also_requires_if.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 3dd576d

Please sign in to comment.