minamijoyo / tfmigrate

A Terraform / OpenTofu state migration tool for GitOps
MIT License
1.14k stars 57 forks source link

use multierror instead of errors.Join #153

Closed bharling closed 1 year ago

bharling commented 1 year ago

just a small fix to help with backwards compatibility for projects stuck on go < 1.20. This just postpones use of errors.Join in favour of multierror.Append. No functional changes.

mdb commented 1 year ago

Thanks @bharling - I'm in support of this!

minamijoyo commented 1 year ago

Aside from acceptance tests failing, could you give me more context about why this is needed? From my point of view, it's hard to justify because:

Merging this patch means I can no longer use the Go 1.20+ feature until you finish upgrading, right?

mdb commented 1 year ago

@minamijoyo I work closely with @bharling and can offer some context...

From my point of view, it's hard to justify

I completely understand; it may not be worth catering to a niche use case. Nonetheless, here's some thoughts to consider...

While it's beyond your original intended use case -- and perhaps not worth supporting -- I do think there's some utility to using tfmigrate as a library as well as a CLI:

Merging this patch means I can no longer use the Go 1.20+ feature until you finish upgrading, right?

Again, I completely understand if you don't want to support tfmigrate's usage as a library, and especially don't want to support its use as a backwards-compatible library for Go < 1.20. However...

That all said, I defer to @minamijoyo :)

And, a big disclaimer: I haven't looked into the acceptance test failures; I value a solution to #129 over < Go 1.20 support. I'm assuming @bharling 's intent is that tfmigrate continues to address issue #129 , but does so without errors.Join.

bharling commented 1 year ago

@minamijoyo I work closely with @bharling and can offer some context...

From my point of view, it's hard to justify

Completely understand and echo the points raised by @mdb above - this is essentially a fairly selfish PR on our part just to unblock our usage of tfmigrate in our current project, totally appreciate it's not helping to advance tfmigrate itself any.

I will take a look into the tests asap though regardless

minamijoyo commented 1 year ago

I do care about compatibility as a CLI but not as a library. That said, I don't intend to hide everything in the internal package as terraform does, so it's ok to use tfmigrate as a library at your own risk with the understanding that breaking changes could be merged at any time. Having that in mind, my answer would be to upgrade your Go version to the latest in general.

Even though you are the author of patch #129 and using the multierror looks relatively harmless, I can accept it as a temporary workaround. If you still wish to do so, could you provide the following information?

Without them, unblocking your project will block this project. It's hard to accept without any timeline.

bharling commented 1 year ago

I do care about compatibility as a CLI but not as a library. That said, I don't intend to hide everything in the internal package as terraform does, so it's ok to use tfmigrate as a library at your own risk with the understanding that breaking changes could be merged at any time. Having that in mind, my answer would be to upgrade your Go version to the latest in general.

Even though you are the author of patch #129 and using the multierror looks relatively harmless, I can accept it as a temporary workaround. If you still wish to do so, could you provide the following information?

  • What is the minimum required version you expect for the time being? < Go 1.20 is insufficient information to care for Go compatibility. Some linters may complain about deprecated features and force us to use new ones.
  • When can I expect to revert the temporary workaround and use the latest Go? It will be out of my control; worst of all, there is no way to know when I can.

Without them, unblocking your project will block this project. It's hard to accept without any timeline.

Thanks very much for taking the time to reply - on reflection I think the best option for tfmigrate would be to close this PR and for us to focus on resolving the upgrade issues our side. I don't want to block progress on tfmigrate nor create a dependency on our own work to revert the changes I'm proposing here.

Thanks again for looking into this and apologies for the waste of time!

minamijoyo commented 1 year ago

I appreciate your understanding, and It's also good to hear your use case 👍