-
-
Notifications
You must be signed in to change notification settings - Fork 986
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
What's up with go module support? #462
Comments
As per the above official recommendation, chi's not going to adopt Go modules until we plan to release v5.0.0. Otherwise, we'd have to introduce a breaking API change, as we'd have to change the import paths to The |
I've been thinking about this for a while and I believe I have the approach that will make me the happiest. Chi needs to get proper go.mod compatibility, and with our current versioning from v1.0.0 to v4.0.0, it requires as @VojtechVitek suggests to add the suffix Therefore, here's my idea. We can still do that! and re-version v2.0.0 as v1.2, v3.0.0 as v1.3, and v4.0.0 as v1.4. |
That is an interesting idea! But we'd have to make it clear that v1.4 is not really backward compatible with all v1.x versions, as it should be per semver specs. Example of breaking changes:
But thinking about it.. when did we switch from https://github.com/pressly/chi to https://github.com/go-chi/chi? Maybe go-chi/chi v1.0.0 wasn't actually referenced by anyone and we're good to go? (and maybe we could even go for v1.0.0 ?! :D) 👍 |
@VojtechVitek yes thats true. v1.0.0 was used by github.com/pressly/chi which has been deprecated for many years. We could peg our next release as v1.0.0 -- but what would we do to retag previous versions? |
@pkieltyka I propose:
|
With the module proxy, sumdb, and existing projects with versions set, I can't see force-dropping a bunch of tags and re-versioning going too well. I'd personally be much happier to see a |
There is one another thing.. if we are braking BC.. can we also get support for "named" routes, so we can reverse build URLs |
hey all, I'm going to approach this one cautiously. I don't want to break backwards-compat and hurt people's experience, but I also can't move forward with our versioning and go.mod's functionality as a lot of editors (specifically vscode) have a poor experience with modules (since they're still kinda new). I have an idea of what to do but I'll need to test it in isolation in a separate mock environment. I'll report back once I've had a chance to do that. If someone else has other ideas/insights, lmk too please. Thanks |
@thepudds previously helped out with the module situation in github.com/ugorji/go, perhaps they have a suggestion. Otherwise (if they're not too busy getting the 1.14 beta out the door 😄 ), I'm sure @bcmills or @jayconrod have good suggestions. My personal suggestion is to try to not be fancy with the solution. I'm not sure what backwards compatible scenarios you're trying to enable, but if it's solely trying to handle non-module users, I'm not sure how valuable that'd be. The version directory method could help (but it's not my personal favorite). For what it's worth, my experience in VS Code with gopls has not been bad at all; I've been using it for months with some minor issues (which I've reported and have mostly been fixed), but maybe your experience has been different. |
The “major subdirectory” layout is compatible with both module mode and GOPATH mode. If you don't want to maintain two copies of the code, one simple option is to leave forwarding packages at the unversioned paths that use aliases and forwarding functions to redirect to the versioned ones. Also note that there is an upcoming change (in 1.14) to ignore incompatible major versions when resolving the “latest” version if a |
thanks @bcmills for the feedback and nice to know about the 1.14 updates too |
I believe the best would be to just release a new v5 with new import path and leave the past in the past as it is. |
Please can I get some clarity on what we're supposed to do right now to get the latest version. Is it just to put |
@Mentioum Get the latest chi (as of today) with |
Thanks @VojtechVitek |
Fighting against the edit: I'm asking for this project to embrace SIV and add the |
At the very least, let's update the README.md to be very clear about the expected behavior. |
Be explicit about using v4.x tags. Addresses go-chi#462.
Be explicit about using v4.x tags. Addresses #462.
Color me a bit confused, but I see now that there's a new tag v1.5.0 after v4.1.2. This does get picked as the "latest" in a new project without If I do Is there no chance of just bumping this up to |
Hey all, chi now has go.mod support! Please see #560 -- thanks for your patience. Please read the PR description for more information on the versioning update. |
Unfortunately, this does not play nicely when other dependencies I have depend on "newer" versions of chi by version. Somewhere in my dependency tree, a dependency requests at least It's now essentially impossible for me to depend on chi at anything but v4+, because attempting to use anything else will effectively "downgrade" me to a higher version number. I understand that you aren't a fan of the aesthetics of having a version number in your import path, but this is really not going to work well when existing projects with modules already have versions above v1 in their dependency graph. If you don't want to add |
Go at tip has better messages when moving between versions. Here's what's happening to me:
|
Sorry to hear you're having trouble with the upgrade. I believe part of the issue is go module cache. With Go 1.16 and retractable versions this will definitely get smoother, but you can try to remove from go.mod and go.sum the incompatible versions of chi and then add @v1.5.1 -- lmk how it goes |
That's the first thing I tried, yes. I cleared my entire mod cache and even used I'm pretty certain v1.5.1 is treated as before v3.3.2+incompatible when it comes to Go's sorting of versions. For experimentation, I edited my
But the compiler says:
As v1.5.1 does not satisfy the minimum version required by my dependencies. So though I was hopeful retraction would help, I don't think it will. |
Clarification, Go 1.16 with that list of excludes does actually compile after a |
thanks for helping to debug. Once github.com/99designs/gqlgen upgrades to chi@v1.5.1, you'll be able to upgrade comfortably. The issue is when other dependencies, depend on chi@v4+incompatible, the go mod tool will force the chi version to the dependency's version of chi -- I believe this is happening because they're the same import path. The silver lining here is that chi doesn't change much between versions and apis are the same -- meaning upgrading to the head/master/v1.5.1 will be trivial for any dependency, such as 99designs/gqlgen |
Yes, exactly, because v1.5.1 is still semantically lower than any of the +incompatible versions. That's why I'm saying this is going to turn out to not be so fun to handle, if the ecosystem needs to collectively forget about all of the versions released in the past few years when the tooling is fighting against it. I'm going to try and submit a PR to gqlgen to modify the version to try and make it so I can move to v1.5.1, but I don't think this is how module versioning was intended to be used. I hope I'm wrong, though, and the retraction system in Go 1.16 is able to smooth this over. Chi is still my favorite router and I want to use it! |
@zikaeroh @pkieltyka I've updated chi on gqlgen master, let me know how it goes, if it's all good i'll cut a proper release for gqlgen. |
Thanks for that merge. I've already bumped it up in my project that uses gqlgen without issue. Hopefully I don't import anything else still using the old |
Hi all, I've just tried gqlgen@master and seems to work with chi@v1.5.1 Here is my general upgrade path for a project:
for gqlgen, I simply ran:
|
@zikaeroh, lazy loading will also help with pruning out spurious transitive dependencies, but unfortunately I didn't get that finished in time for 1.16. 😞 |
Be explicit about using v4.x tags. Addresses go-chi/chi#462.
Go
1.13
is out,GOPATH
is gone. Most of the packages have go module support.What's holding Chi back? How can I help?
The text was updated successfully, but these errors were encountered: