Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unused method: runtypes.{Resources,DataSources}.Diagnostic #2106

Merged
merged 1 commit into from
Jun 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 2 additions & 7 deletions pf/internal/pfutils/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,8 @@ func checkDiagsForErrors(diag diag.Diagnostics) error {
}

type entry[T any] struct {
schema Schema
t T
diagnostics diag.Diagnostics
schema Schema
t T
}

type collection[T any] map[runtypes.TypeName]entry[T]
Expand All @@ -73,7 +72,3 @@ func (c collection[T]) Has(name runtypes.TypeName) bool {
func (c collection[T]) Schema(name runtypes.TypeName) Schema {
return c[name].schema
}

func (c collection[T]) Diagnostics(name runtypes.TypeName) diag.Diagnostics {
return c[name].diagnostics
}
5 changes: 2 additions & 3 deletions pf/internal/pfutils/datasources.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,8 @@ func GatherDatasources[F func(Schema) shim.SchemaMap](
}

ds[runtypes.TypeName(meta.TypeName)] = entry[func() datasource.DataSource]{
t: makeDataSource,
schema: FromDataSourceSchema(dataSourceSchema),
diagnostics: diag,
t: makeDataSource,
schema: FromDataSourceSchema(dataSourceSchema),
}
}

Expand Down
5 changes: 2 additions & 3 deletions pf/internal/pfutils/resources.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,8 @@ func GatherResources[F func(Schema) shim.SchemaMap](
}

rs[runtypes.TypeName(meta.TypeName)] = entry[func() resource.Resource]{
t: makeResource,
schema: FromResourceSchema(resSchema),
diagnostics: diag,
t: makeResource,
schema: FromResourceSchema(resSchema),
}
}

Expand Down
2 changes: 0 additions & 2 deletions pf/internal/runtypes/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ package runtypes
import (
"context"

"github.com/hashicorp/terraform-plugin-framework/diag"
"github.com/hashicorp/terraform-plugin-go/tftypes"

shim "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim"
Expand Down Expand Up @@ -45,7 +44,6 @@ type collection interface {
All() []TypeName
Has(TypeName) bool
Schema(TypeName) Schema
Diagnostics(TypeName) diag.Diagnostics
}

// Represents all provider's resources pre-indexed by TypeName.
Expand Down
6 changes: 0 additions & 6 deletions pf/proto/runtypes.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ package proto
import (
"context"

"github.com/hashicorp/terraform-plugin-framework/diag"
"github.com/hashicorp/terraform-plugin-go/tfprotov6"
"github.com/hashicorp/terraform-plugin-go/tftypes"

Expand Down Expand Up @@ -92,8 +91,3 @@ func (c collection) Schema(key runtypes.TypeName) runtypes.Schema {

return schema{s}
}

func (c collection) Diagnostics(runtypes.TypeName) diag.Diagnostics {
// It's not clear how to split diagnostics by resource
return nil
}