gizak / termui

Golang terminal dashboard
MIT License
13.07k stars 783 forks source link

Make termui Go modules friendly #225

Closed divan closed 5 years ago

divan commented 5 years ago

As termui is a project that's actively being developed through years and sometimes breaks API, It would be awesome to make it friendly to the Go modules.

A couple of specific things here:

  1. Tag new versions before any API breaks. It'll give some cushion and enough time to transition to the new API, and the transition will be as easy as bumping up the version in go.mod. Latest "The Great Rewrite" commit definitely deserved new version, for example.
  2. Currently, go mod marks termui as +incompatible because of v2 version. You will probably need to change module definition in go.mod to module github.com/gizak/termui/v2 to play nice with Go modules.

Thanks for the terrific library!

cjbassi commented 5 years ago

Thanks for the suggestions. So I'm pretty confused about this whole go modules business tbh. I checked out the go modules wiki and it sounds like:

  1. I need to create a new v3 release to properly add go module support.
  2. I need to update the module definition in go.mod to include v3.
  3. Packages that use termui need to include v3 in the import path.

How would that compare to just updating the current go.mod file to include v2 in the module definition like you said?

Also, termui is still in the process of figuring out the API, so more breaking changes may still be in the works so doing a major bump right now would be unfortunate.

cjbassi commented 5 years ago

Another question, is there any issues with installing termui using the recommended method of doing go get -u github.com/gizak/termui@master in regards to go modules for the time being? Genuinely curious, especially since termui is still in flux atm.

edit: So it seems like the +incompatible occurs when using v2.3.0 which doesn't support Go modules. Should I backport go module support and add a v2.3.1 release? Would that fix these issues?

sedlund commented 5 years ago

I am very new to this as well, and am getting the +incompatible flag and the old tag doesn't seem to compile for me.

I think adding a 2.3.1 tag would fix it.

edit: also, go get -u github.com/gizak/termui@master does seem to fix it as well, it updates go.mod

cjbassi commented 5 years ago

So v3 was just released with Go module support! You'll have to update your import paths to include v3 as per Go modules convention for modules >v1. There was also a few minor breaking changes just to clean up the API, but those are all done now :relieved: . Also, I don't think backporting Go modules to v2 is really worth it. So at this point, I think this issue is resolved. I'm closing this but let me know if there's any issues with Go modules or migrating to v3.