Skip to content

Commit

Permalink
fix: remove rpc_friendly.go (#2800)
Browse files Browse the repository at this point in the history
Vendoring opentofu/tfdiags/rpc_friendly.go is not strictly needed but
caused issues with encoding/gob such as the one in the referenced issue.

Fixes #2784
  • Loading branch information
t0yv0 authored Dec 27, 2024
1 parent daafe0d commit 7550624
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 85 deletions.
21 changes: 13 additions & 8 deletions pkg/vendored/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -236,11 +236,6 @@ func vendorOpenTOFU(version string) {
dest: "tfdiags/diagnostic_base.go",
transforms: transforms,
},
{
src: "internal/tfdiags/rpc_friendly.go",
dest: "tfdiags/rpc_friendly.go",
transforms: transforms,
},
{
src: "internal/tfdiags/contextual.go",
dest: "tfdiags/contextual.go",
Expand Down Expand Up @@ -271,9 +266,19 @@ func vendorOpenTOFU(version string) {
}),
},
{
src: "internal/tfdiags/diagnostics.go",
dest: "tfdiags/diagnostics.go",
transforms: transforms,
src: "internal/tfdiags/diagnostics.go",
dest: "tfdiags/diagnostics.go",
transforms: append(transforms, func(s string) string {
code := `func (diags Diagnostics) ForRPC() Diagnostics {
ret := make(Diagnostics, len(diags))
for i := range diags {
ret[i] = makeRPCFriendlyDiag(diags[i])
}
return ret
}
`
return strings.ReplaceAll(s, code, "")
}),
},
{
src: "internal/tfdiags/sourceless.go",
Expand Down
7 changes: 0 additions & 7 deletions pkg/vendored/opentofu/tfdiags/diagnostics.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,13 +123,6 @@ func (diags Diagnostics) HasErrors() bool {
// Note that this loses information about the original objects used to
// construct the diagnostics, so e.g. the errwrap API will not work as
// expected on an error-wrapped Diagnostics that came from ForRPC.
func (diags Diagnostics) ForRPC() Diagnostics {
ret := make(Diagnostics, len(diags))
for i := range diags {
ret[i] = makeRPCFriendlyDiag(diags[i])
}
return ret
}

// Err flattens a diagnostics list into a single Go error, or to nil
// if the diagnostics list does not include any error-level diagnostics.
Expand Down
70 changes: 0 additions & 70 deletions pkg/vendored/opentofu/tfdiags/rpc_friendly.go

This file was deleted.

0 comments on commit 7550624

Please sign in to comment.