Skip to content

Commit

Permalink
Fix linter errors
Browse files Browse the repository at this point in the history
  • Loading branch information
dadgar committed Oct 11, 2023
1 parent 6aebad1 commit 15b67b3
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 16 deletions.
6 changes: 3 additions & 3 deletions internal/hcpvalidator/display_name.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ type displayNameValidator struct {
}

// Description describes the validation in plain text formatting.
func (validator displayNameValidator) Description(_ context.Context) string {
func (v displayNameValidator) Description(_ context.Context) string {
return invalidDisplayNameErr
}

// MarkdownDescription describes the validation in Markdown formatting.
func (validator displayNameValidator) MarkdownDescription(ctx context.Context) string {
return validator.Description(ctx)
func (v displayNameValidator) MarkdownDescription(ctx context.Context) string {
return v.Description(ctx)
}

// Validate performs the validation.
Expand Down
8 changes: 0 additions & 8 deletions internal/hcpvalidator/display_name_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,6 @@ func TestDisplayNameValidator(t *testing.T) {
func TestDisplayNameValidator_Good(t *testing.T) {
t.Parallel()

type testCase struct {
val types.String
expectError bool
}
tests := []string{
"goodName", "1goodName", "goodName1", "good-Name", "good1Name2", "goodNamE",
"GOODNAME", "GOODNAME1", "GOOD-NAME", "GOOD1NAME2", "GOODNAME",
Expand Down Expand Up @@ -91,10 +87,6 @@ func TestDisplayNameValidator_Good(t *testing.T) {
func TestDisplayNameValidator_Bad(t *testing.T) {
t.Parallel()

type testCase struct {
val types.String
expectError bool
}
tests := []string{
"bad@", "bad#", "bad$", "bad%", "bad^", "bad&", "bad*", "bad(", "bad)", "bad/", "bad\\",
"a", "1", "-",
Expand Down
6 changes: 3 additions & 3 deletions internal/hcpvalidator/resource_name_part.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ type resourceNamePartValidator struct {
}

// Description describes the validation in plain text formatting.
func (validator resourceNamePartValidator) Description(_ context.Context) string {
func (v resourceNamePartValidator) Description(_ context.Context) string {
return invalidResourceNamePartErr
}

// MarkdownDescription describes the validation in Markdown formatting.
func (validator resourceNamePartValidator) MarkdownDescription(ctx context.Context) string {
return validator.Description(ctx)
func (v resourceNamePartValidator) MarkdownDescription(ctx context.Context) string {
return v.Description(ctx)
}

// Validate performs the validation.
Expand Down
3 changes: 1 addition & 2 deletions internal/provider/resourcemanager/data_source_project.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,9 @@ func (d *DataSourceProject) Read(ctx context.Context, req datasource.ReadRequest

// Determine the ID
id := data.Project.ValueString()
id = strings.TrimPrefix(id, "project/")
if id == "" {
id = d.client.Config.ProjectID
} else if strings.HasPrefix(id, "project/") {
id = strings.TrimPrefix(id, "project/")
}

if d.client == nil {
Expand Down

0 comments on commit 15b67b3

Please sign in to comment.