mattn / go-runewidth

wcwidth for golang
MIT License
610 stars 94 forks source link

Semantic Versioning: `ZeroWidthJoiner` Removal #58

Open trynity opened 2 years ago

trynity commented 2 years ago

ZeroWidthJoiner was removed after v0.0.9: https://github.com/mattn/go-runewidth/blob/v0.0.9/runewidth.go#L14

The next version was v0.0.10, but this introduced a breaking API change.

While being v0 means you can introduce breaking API changes, would it be possible to get a v1 release that can ensure API stability?

It's fine to just keep cutting new versions when API changes happen, but right now it makes managing Go Module dependencies rather painful, since it just assumes patch versions don't introduce breaking changes.

mattn commented 2 years ago

I'm thinking global variable ZeroWidthJoiner is not used for everyone properly since the variable is overwritten in init function.

mattn commented 2 years ago

However, I'm also considering upgrading the minor version.

rivo commented 2 years ago

To my knowledge, I was the only one using it and I'm ok with this change.

W1M0R commented 1 year ago

This also reintroduces the following issues when building older projects that were pinned to a version of tview that relied on ZeroWidthJoiner:

  1. https://github.com/rivo/tview/issues/205
  2. https://github.com/rivo/tview/issues/189

To resolve the issue, I updated the project go.mod file to use the latest tview at the time, e.g.

        // github.com/rivo/tview v0.0.0-20210111184519-c818a0c789ee // original
        // github.com/mattn/go-runewidth v0.0.8 // indirect - via tview above
    github.com/rivo/tview v0.0.0-20230406072732-e22ce9588bb4 // updated
    github.com/mattn/go-runewidth v0.0.14 // indirect - via tview above

I would have preferred to stick with the original pinned tview, but all of my attempts to pin a matching and compatible go-runewidth version in the go.mod file was not successful.

Even though go-runewidth v0.0.8 has the ZeroWidthJoinerField field, somehow go seems to be looking at a version that doesn't have the field.

Not sure what to make of it, and probably not that important, but just presenting the info in case it helps someone else.

rivo commented 1 year ago

Special ZeroWidthJoiner handling was a mistake. We didn't understand Unicode fully back then. tview was the only project using this flag and it hasn't used it anymore for quite a long time. So there's currently no other project that needs ZeroWidthJoiner and it makes sense to remove it.

I would think that if there's an old project which uses an old version of tview, it would also reference the correct go-runewidth version which still has ZeroWidthJoiner so I'm also not sure why there's an error message related to that.

I would have preferred to stick with the original pinned tview

In any case, tview is backwards compatible. You could upgrade tview to the latest version and your program should still work.

W1M0R commented 1 year ago

Thanks for the feedback @rivo. I've upgraded to the latest version of your package, and everything seems to be working well. Thanks for your backwards-compatibility efforts!