Skip to content
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

chi@v1.5.x mod issues #561

Closed
umputun opened this issue Dec 7, 2020 · 76 comments
Closed

chi@v1.5.x mod issues #561

umputun opened this issue Dec 7, 2020 · 76 comments

Comments

@umputun
Copy link

umputun commented Dec 7, 2020

I have tried to switch to v1.5.0 from v4.1.2+incompatible but because the version number decreased it caused a downgrade of all other dependencies using chi. For example, I have started with this:

git.example.com/commons/pkg/rest v1.3.2
github.com/go-chi/chi v4.1.2+incompatible
github.com/go-chi/render v1.0.1

After running go get github.com/go-chi/chi@v1.5.1 I got:

git.example.com/commons/pkg/rest v1.1.0
github.com/go-chi/chi v1.5.1
github.com/go-chi/render v1.0.1

As you can see my pkg/rest downgraded to some old version and such side effects can be very unexpected and unpleasant.

Is there a reason why you decided to go with v1.5.x and not with a more traditional (and less dangerous) approach with v5 (also changing the package name to "/v5")? I'm not sure how to deal with this. In order to avoid those unexpected downgrades I have to have all of my dependencies migrated to v1.5, but unfortunately some of them not under my control.

@pkieltyka
Copy link
Member

pkieltyka commented Dec 7, 2020

Sorry for the trouble -- I realize this is an unusual change, but unfortunately the versioning nuance pre-date go.mod's existence. For dependencies which themselves depend on chi, they will have to be updated to chi@v1.5.1 as well, in order to make use of the new go.mod version -- which is confusing by "numbers", but is the same in either case if a new v5 was released just the same.

As for the reasoning to switch back to v1, please see #560.

Note, Go 1.16 will include a new feature for go.mod to mark certain versions as "retracted", which should smooth this out and allow you to upgrade then. TBH, there are not many urgent features in chi from v4+incompatible to v1 with go.mod. However, I've had no issues switching to chi v1.5.1 (go.mod) for all of my projects internally.

@umputun
Copy link
Author

umputun commented Dec 7, 2020

thx, I just read the discussion in #462 and @zikaeroh summarized it nicely - "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...". It is indeed not fun and even worse, because in my case an innocent-looking and minor update of the chi module triggered a chain reaction downgrading other dependencies, some of them significantly.

I understand you made the call and it is what it is. However, I'd suggest documenting possible risks or at least mention in README how potentially destructive such a go get -u github.com/go-chi/chi@v1.5.0 could be in case if it has a dependency which themselves depend on chi.

Btw, I think if instead of v1.5.x you tag it v5.0.0 it won't break as much as v1.5.x does. I believe v5.0.0 will be considered higher than any of the +incompatible versions by go get, but not 100% sure

@zikaeroh
Copy link
Contributor

zikaeroh commented Dec 7, 2020

Btw, I think if instead of v1.5.x you tag it v5.0.0 it won't break as much as v1.5.x does. I believe v5.0.0 will be considered higher than any of the +incompatible versions by go get, but not 100% sure

Doing so with a go.mod will require the import path to be github.com/go-chi/chi/v5. You cannot tag a version above v1 with modules and avoid having the version in the path. Only legacy code (as chi was before) can do that. (My opinion is that doing /v5 would probably cause fewer issues than this version hacking; we'll see what happens with this current plan.)

@umputun
Copy link
Author

umputun commented Dec 7, 2020

My opinion is that doing /v5 would probably cause fewer issues than this version hacking;

Completely agree. I have migrated a dozen libraries from pre-mod to post-mod world with /v2 path change and had no problem with this approach. It feels odd and ugly but works fine and safe

@frederikhors
Copy link

frederikhors commented Dec 7, 2020

My opinion is that doing /v5 would probably cause fewer issues than this version hacking

I agree too.

@pkieltyka please release v5 and start from there, please. "Downlograding" to v1.5.1 in a medium project changes all the dependencies to lower ones, as already reported by @umputun. It's a mess!

Please reconsider and use v5 from now on. Nobody will care about the change from 1 to 5, trust me, it just works!

UPDATE:

As it is it just doesn't work. I'm sorry.

Everytime I try to "update" to v1.5.1 IDEs or simply go run take me to github.com/go-chi/chi v3.3.2+incompatible version.

If I force v1.5.1 (with go get -u github.com/go-chi/chi@v1.5.0) it decreases a lot of dependencies! It's really crazy and I'm sad.

UPDATE 2:

I removed all Golang files from my PC. All go mod cache. Everything! Still the problem.

I tried on a new PC with Golang never installed there. Same issue.

@pkieltyka
Copy link
Member

hey all, sorry again for these troubles. It upsets me as well to see others having trouble with it. I sure wish go.mod was a thing before chi was created.

@frederikhors yes, the downgrading is quite annoying and crazy. However, @zikaeroh helped point out the source of the issue -- which is that in your project if there is a dependency which depends on chi@v3+incompat or chi@v4+incompat, and you try to install chi@v1.5.1, it will assume you're downgrading and then all of those dependencies are arbitrarily downgraded. The only way to resolve this is to ensure that the dependency tree, starting from the deepest package, uses chi@v1.5.1.

I've found the best upgrade path for a project:

  1. go mod graph | grep "go-chi/chi" -- prints the graph and shows packages on the left which depend on chi
  2. Assuming all sub-deps are upgraded to chi@v1.5.1, you can just run go get -u, but, for more clear upgrade path then, for each package which depends on chi, first ensure that package is upgraded to chi@v1.5.1, then run go get <the-dep-which-deps-on-chi>@latest or instead of @latest use vX of the version which is the newest for that dep (in case of cache..). @master also works fine
  3. go get github.com/go-chi/chi@v1.5.1 -- or @latest also works but sometimes cache will get in the way
  4. go mod tidy -- always good to run

for gqlgen, I simply ran:

  1. go get github.com/99designs/gqlgen@master
  2. go get github.com/go-chi/chi@v1.5.1
  3. go mod tidy

@frederikhors
Copy link

frederikhors commented Dec 7, 2020

So I have to contact the author of each project and explain that he has to upgrade a dependency using in fact a downgrade.

And that he must be careful before doing so by making sure that each of his dependencies are in turn upgraded to a downgraded version.

All this recursively.

Can't we use v5 and we are all happier and that is the end of this story? 😄

@frederikhors
Copy link

I love chi, please.

@pkieltyka
Copy link
Member

@frederikhors can you post your dep graph that uses chi? In general, it shouldn't be a child dep of very many packages, nor should be very deep.

@frederikhors
Copy link

I cannot because it's corporate. I'm very sorry about this. And I'm very curious about the new fix for less allocations!

@umputun
Copy link
Author

umputun commented Dec 7, 2020

@pkieltyka this is my graph for one of the small services (I have used fake names because this is an internal project) :

> go mod graph | grep "go-chi/chi"
git.example.com/service/blah github.com/go-chi/chi@v4.1.2+incompatible
thirdparty.com/authenticator@v1.3.1 github.com/go-chi/chi@v4.1.2+incompatible
git.example.com/commons/pkg/rest@v1.1.4 github.com/go-chi/chi@v4.0.2+incompatible
git.example.com/commons/pkg/rest@v1.3.2 github.com/go-chi/chi@v4.1.2+incompatible

As you can see even in a small project I have 2 different issues with v1.5.x migration:

  1. thirdparty.com/sys/authenticator - the module is external, there is no way for me to force the migration of this one to v1.5.x
    2 pkg/rest seems to be used by some other module(s) as well and they use different versions of the module. Each one of them seems to use a different chi version

To me, both cases look perfectly fine and usual. Updating any other dependency (the one not forcing downgrade) will be trivial, painless, and, most important - relatively safe. Updating chi module is very tricky and extremely scary. If one of my junior developers runs the recommended procedure and not watching go.mod carefully, it could bring back a bunch of old dependencies with various old bugs. In fact, I had to send a group email prohibiting the upgrade of v4.x.x+incompatible due to the potential risks involved.

Sure, this is your project and your decision to make, but in my opinion all v.1.5.x idea should be reconsidered one more time

@carldunham
Copy link

Just to throw in another wrinkle here, we have to fix our version of github.com/99designs/gqlgen to 0.11.3 due to a bug that hasn't been fixed there yet. While we could fork and apply the very nice PR that fixes the bug, and would include chi 1.5.1, we would prefer not to. So that also leaves us unable to upgrade chi on any other packages for now.

Not the end of the world, but it hurts to see interlock between dependencies like this, especially when everyone has worked so hard to maintain backward compatibility within major versions.

@VojtechVitek
Copy link
Contributor

Here's my report upgrading pretty large project using Go 1.15.

$ go get github.com/go-chi/chi@v1.5.1
go: downloading github.com/go-chi/chi v1.5.1
 $ git diff
 modified: go.mod
 
-    github.com/go-chi/chi v4.0.2+incompatible
+    github.com/go-chi/chi v1.5.1
     github.com/go-chi/cors v1.1.1
-    github.com/go-chi/docgen v1.0.5
+    github.com/go-chi/docgen v1.0.3
     github.com/go-chi/jwtauth v3.2.0+incompatible
     github.com/go-chi/render v1.0.1
-    github.com/mailgun/mailgun-go/v3 v3.5.0

This has removed github.com/mailgun/mailgun-go pkg because mailgun depends on chi v4.x.x. And in our project, we use v3 of this library, while the upstream is on v4 already. This will be interesting.

We use /vendor directory in our project. So I tried to regenerate it:

$ go mod vendor && go mod tidy
go: finding module for package github.com/mailgun/mailgun-go/v3
go: finding module for package github.com/mailgun/mailgun-go/v3/events
go: found github.com/mailgun/mailgun-go/v3 in github.com/mailgun/mailgun-go/v3 v3.6.4
go: found github.com/mailgun/mailgun-go/v3/events in github.com/mailgun/mailgun-go/v3 v3.6.4
  $ git diff
  modified: go.mod
 
-    github.com/go-chi/chi v4.0.2+incompatible
+    github.com/go-chi/chi v4.0.0+incompatible
     github.com/go-chi/cors v1.1.1
-    github.com/go-chi/docgen v1.0.5
+    github.com/go-chi/docgen v1.0.3
     github.com/go-chi/jwtauth v3.2.0+incompatible
     github.com/go-chi/render v1.0.1
-    github.com/mailgun/mailgun-go/v3 v3.5.0
+    github.com/mailgun/mailgun-go/v3 v3.6.4

And it looks like this actually reverted the new chi update altogether, because go mod vendor most likely preferred v4.0.0+incompatible coming from the mailgun dependency over the "newer" v1.5.1.

Should the go tool chain prefer v1.5.1 over the v4.0.0+incompatible? I'd say so.. but it looks like it doesn't. And these v4.x.x+incompatible versions are all indexed/cached by the default GOPROXY at https://proxy.golang.org forever, so we might be hitting this issue over and over again. Should we report this as a bug to Go toolchain?

I think I hit the same "transitive dependency" issue as the guys above.

So, do we really need to fix all these?
https://pkg.go.dev/github.com/go-chi/chi?tab=importedby

It feels like there's no silver bullet. It's too bad Go didn't have modules support sooner.

  • /v5 is annoying, as it'd force users to update all import paths in their codebase & it's not easily discoverable
  • Introducing github.com/<NEW-ORG-NAME>/chi would have similar problems, but at least we would be able to start versioning from v1.x properly
  • v1.5.x has the above transitive dependency issues that will keep recurring and I'm sure this thread will grow over time
  • v4.x.x+incompatible was kinda OK.. I'd argue to switch back to it

Anyway, I appreciate all the hard work @pkieltyka is doing on this project. ❤️

@frederikhors
Copy link

frederikhors commented Dec 9, 2020

@VojtechVitek we all appreciate @pkieltyka's work: Chi is amazing! This is why I insist on v5 to close this once and for all.

@mfcochauxlaberge
Copy link

Yes, please, this should be v5.

@mfridman
Copy link

mfridman commented Dec 9, 2020

From what I understand, this might be less of a problem in the future with Go 1.16 and 1.17

Where in 1.16 your internal project can use v1.5.x while upstream dependencies continue to use v4.0.0+incompatible. This is with the exclude directive.

If you exclude github.com/go-chi/chi v4.0.0+incompatible, then Go 1.16 will pretend that the requirements on that version that it finds in your dependency graph simply don't exist.

(But that doesn't help if you have downstream consumers — who won't pick up your exclude directives — or for ~anyone at all before Go 1.16 is released.)

Now the more interesting bit will come in Go 1.17 with "lazy loading". more info cmd/go: lazy module loading

Update your direct dependencies, and try to push everything else past the lazy-loaded horizon


None of this makes a difference today though.

Was v4.x.x+incompatible all that bad ¯_(ツ)_/¯ ?

@programmer04
Copy link

I have also dependencies in my project which depend on chi:

go mod graph | grep "go-chi/chi"
github.com/xd/my-amazing-project github.com/go-chi/chi@v4.1.2+incompatible
github.com/deepmap/oapi-codegen@v1.3.13 github.com/go-chi/chi@v4.0.2+incompatible
github.com/influxdata/influxdb/v2@v2.0.2 github.com/go-chi/chi@v4.1.0+incompatible

@jones2026
Copy link

Another issue with this new version is any automated dependency management tools (i.e. renovate, dependabot, etc...) all want to "upgrade" chi to v4.x.x from v1.5.x since it sees this as semantically lower.

@bcmills
Copy link

bcmills commented Dec 16, 2020

@jones2026, that seems like an issue to file against the automated tools. They should generally be using go list -m $path@latest or go get -u -d all rather than trying to infer the latest version themselves. (That's especially important given the possibility of retracting a release — see golang/go#24031.)

@jones2026
Copy link

@bcmills is that available now or is that coming in release 1.16 for Go? I definitely agree if Go has a way to not pull in deprecated packages and these older versions are marked as such then the tools need to adjust

@bcmills
Copy link

bcmills commented Dec 16, 2020

@jones2026, cmd/go retraction support is coming in 1.16.

@dominikbraun
Copy link

dominikbraun commented Dec 16, 2020

Please don't do this. Referring to the PR that introduced this change:

Any breaking changes will bump a "minor" release and backwards-compatible improvements/fixes will bump a "tiny" release.

This will be a huge red flag for any serious project maintainer. When a new "minor" version is released, VS Code and Dependabot will ask people to update chi, and then their projects will be broken because the release introduces breaking changes. Or even crazier, they want to update to version 4 and actually perform a downgrade. Such a behavior is a significant reason for replacing chi.

The maintainer of Fiber had the same idea, but finally changed their mind: gofiber/fiber#736 (comment)

@jones2026
Copy link

@bcmills do you know if those go commands will guarantee to return a list of versions in the correct order if semantic versions are not trusted? Or is it only possible to get the latest release with those? Hoping to make a PR into renovate to make sure it behaves the correct way

@pkieltyka
Copy link
Member

hey all, thanks for the feedback on this issue. It’s unfortunate there are a combination of hiccups — mainly that Go is downgrading other packages unexpectedly, which I agree is a big problem.

I do not want to release /v5 and see it on the import path. Rather I’ll probably remove the go.mod support and go back to incompatible mod version tomorrow from v4.x. I hope one day Go’s module support will allow me to control the import path and avoid subscribing to /vX, as the versions are already tracked in source tags and go.sum — the only advantage I see of that format is to support multiple versions of the same package, which id prefer to opt out.

Apologies for the annoyance here — I’ll sleep on it, and tomorrow find a better path forward.

@zikaeroh
Copy link
Contributor

Rather I’ll probably remove the go.mod support and go back to incompatible mod version tomorrow from v4.x.

If the retraction system in 1.16 works, then it would alleviate this; I'd almost personally rather things stay as they are and maybe see how that goes (mod file and 1.5, some people can't upgrade) than to switch more than once between not having mod support and having mod support.

I can't recall if it'll work, but it'd be interesting if the retract directive could be put in the go.mod now (even though it targets an older version than 1.16), and then see what happens on tip (but 1.16's beta will be soon as well).

@carldunham
Copy link

Honestly, I don’t think the aesthetics of /v5 is all that bad. It’s the cool new version for the cool kids. And I would prefer it to the aesthetics of +incompatible blah-di-blah and all the drama around this so far.

@unitrq
Copy link

unitrq commented Dec 17, 2020

Could changing package name (forking) be an option? This would provide lagging dependencies with time to adjust, while those who depend directly on chi could move forward with it

@chesnokovilya
Copy link

Could we keep version v1.5.1? I already upgraded and its works fine for me.

@frederikhors
Copy link

Could changing package name (forking) be an option? This would provide lagging dependencies with time to adjust, while those who depend directly on chi could move forward with it

Yeah! Let's call it different!

@umputun
Copy link
Author

umputun commented Dec 17, 2020

I do not want to release /v5 and see it on the import path

I'm not sure why you are considering /v5 as a bad thing. I have read previous discussions, and my impression - you don't like the aesthetics of the package name, including /v5 in. Yes, it will be in the import path, but so what? This is how go.mod handles major version updates and seems to be as idiomatic as it gets. For the chi, which I consider to be a very idiomatic routing library, following the standard procedure in version handling makes sense.

Adopting 'github.com/go-chi/chi/v5` on the user side will be trivial, and unless you intorduce breaking changes, all users need to do is adding the "/v5" suffix to the import(s).

My vote for the standard solution. From my experience, aesthetics reasons in go is a dangerous way leading to insane things, like "exception style" error handing with panic/recover, because someone didn't like err !=nil checks, libraries to handle time formatting with "friendly YYYY/MM/DD" because someone can't live with 20060102, HTTP clients "like requests.py" because the author didn't like http.Client and so on.

@PaluMacil
Copy link

It's crazy to see such a bastion of community love and energy descend to this confusion and chaos over trying to take a stand against where the language has gone. I hope this is reconsidered for the community's sake. I get not liking it. It took me a while to be onboard. I liked some aspects, and my mindset drifted a bit over time to like the rest. What I didn't expect was a maintainer torpedoing a well-loved library to make a point. Saying "this is OSS and not sponsored or paid for in any way, and you always have the choice to fork it and maintain your own versions" feels kind of mean-spirited. Sure, @pkieltyka technically has the right to do whatever, but to suggest dropping the package manager support for the language is kind of hurtful to the other 91 contributors who probably all would prefer a unified place to collaborate and work together.

@carldunham
Copy link

It took me a while to be onboard. I liked some aspects, and my mindset drifted a bit over time to like the rest.

That pretty much sums up my entire experience with Go and the Go community. I think of it like some form of Stockholm Syndrome.

@pkieltyka
Copy link
Member

@bcmills I've put together a proposal for a backwards-compatible path to make SIV optional and opt-out at the level of an application developer consuming a package -- golang/go#44550

@PaluMacil
Copy link

It took me a while to be onboard. I liked some aspects, and my mindset drifted a bit over time to like the rest.

That pretty much sums up my entire experience with Go and the Go community. I think of it like some form of Stockholm Syndrome.

I think it's that the Go core team has been thinking about dev problems for a long time, and they have a lot of experience, so they are sometimes able to address a whole problem better than people without their decades of experience. For instance, I wasn't bothered that imports would need to be changed since an IDE or sed or another tool makes that easy. I was bothered by the changeset size in git because I felt that was noise for the sake of noise. However, it's now been pointed out to me that 1. these files that touch an API with a major version update ARE the places where git should point out something changed instead of silent changes being possible anywhere. 2. If I'm working on a large project, my data access or routing or logging imports only touch a couple files, and my other parts of my code are using an interface, and that code is having a change, so it makes sense to me now that I've thought it all through.

Now, I don't like having a different folder for a major version, but that approach isn't required. It's just a shim for older versions of Go, and with most the community having implemented go mod now, I don't think we should be worrying about that going forward.

@cameracker
Copy link

cameracker commented Feb 23, 2021

I think it's that the Go core team has been thinking about dev problems for a long time, and they have a lot of experience, so they are sometimes able to address a whole problem better than people without their decades of experience.

@PaluMacil I think its fair to say that conceptually the design of this package manager works . However, there is a lot to be desired with the UX of the tool, and because ultimately the UX is how a human is going to interact with the software, a lacking UX leads to a lot of distrust and frustration. Especially when people leave the happy path, as we can see here.

@ganigeorgiev
Copy link

ganigeorgiev commented Feb 24, 2021

Similar to @aarondl, I've just accepted the change and migrated my old project.

Was it annoying?
Yes, especially with trying to override the default behaviour of our internal tooling (basically had to exclude manually every other version).

Can I safely rely that updating my dependencies will not break anything?
No, because of the decision to stick to 1.X and not to follow the default semantic versioning.

I'm starting a new project but I don't want to deal with the tooling hacks again and decided to pick/write something else.

For me in the end, going against the accepted "go module way" of doing things just because of some import path aesthetics is not worth all the troubles.
Anyway, I'm grateful @pkieltyka and the other contributors for chi but I don't think that the versioning decision was well thought out.

@icholy
Copy link

icholy commented Feb 24, 2021

Another option is doing what protobuf v2 did and change the import path. The new repo can keep the versions at 0.x.x to avoid SIV. The old repo can undo the hacks that are breaking everyone.

@pkieltyka
Copy link
Member

pkieltyka commented Feb 27, 2021

hi all, for the greater good of everyone who's adopted chi, I am going to push the v5 with SIV import path. I've submitted my Go proposal golang/go#44550 to the team and have given my best shot at providing a suggestion and perhaps opening a conversation up for building in the ergonomics I'm seeking, but also maintain compatibility with the current module system. I believe the best decision will be made, whether to accept/reject, etc. In any regard whatever is decided, I will need to upgrade to v5 properly, and so I will do so now and see what the future brings.

As I prepare to do that, I'd like to get things back on track and continue on a smooth ride for users and past adopters. I've been thinking to "undo" old hacks which block old use, or perhaps just releasing v5 will solve it (but I think not as v1.5.3 retracts other versions)?

Please let me know if you have suggestions on how to properly "undo" the hacky version (v1.5.3) so it will cooperate with Go's tooling and existing uses. My thought is the only problematic version is "v1.5.3" of chi, as it retracts all other versions -- can I just remove the v1.5.3 git tag from github to remove it from the history and release v5.0.0? I suspect that will still have wrinkles in it for older adopters of v4.x.x+incompatible or even v1.5.x, as the Go modules remote index will still recognize v1.5.3's existence?

thanks

@zikaeroh
Copy link
Contributor

zikaeroh commented Feb 27, 2021

I would make the change to remove the retractions, release it as v1.5.4. Then, switch the paths to v5, tag v5.0.0, and push.

IIRC there's some restriction around which modules can retract other modules, since different SIV versions are distinct modules, the above is a straight revert.

I would not remove tags. The versions will still persist in caches and proxies.

@umputun
Copy link
Author

umputun commented Feb 27, 2021

great news!

can I just remove the v1.5.3 git tag from github to remove it from the history and release v5.0.0?

I think it will work. Maybe it makes sense to remove the retraction of v4.x.x as well

@svengreb
Copy link

svengreb commented Feb 27, 2021

First off: Thanks a lot for the effort you put into this project 💙

Removing a tagged version, or a whole repository, is always a bad idea for a dependency system. Even when ecosystems learned their lesson after left-pad crashed half of the NPM world, it should be avoided.

In the FAQs of the GOPROXY the question about “removing a bad release from my repository“ also suggests to “create a new version and encourage people to use that one instead“. Version 1.5.3 is already cached and it has been picked up by many GOPRIVATE proxies as well.

Publishing 1.5.4 and v5.0.0 afterwards should be the “cleanest“ way. Users who run into problems should be taken care of by documenting the version history of chi in a prominent place, e.g. the repository README, including some information how to solve the conflicts.

@pkieltyka
Copy link
Member

pkieltyka commented Feb 27, 2021

Sounds like a plan. Here's next steps as I see:

  1. Please provide second set of eyes here Prepare v1.5.4, removing previous retraction in 1.5.3 #590 -- I'd like to be extra cautious here as I'm not fully sure how retracting a retract will work? It sounds like though removing it will tell Go's module index to accept the @latest version's go.mod retract statement as the source of truth, which as of v1.5.4 will be gone? Or how will the GOPROXY / remote index look at this? The goal is to allow v4.x.x+incompatible to continue to work

  2. Update to github.com/go-chi/chi/v5 as normal and release v5.0.0 v5.0.0 #591

thanks all for your help and patience with this issue.

@zikaeroh
Copy link
Contributor

Both PRs look good to me; the Go tooling looks at whatever is latest for its source of truth, so tagging v1.5.4 will be the "latest" for the old series of releases.

The only thing left will be to update the various go-chi org repos that depend on this repo; I'm not sure how many of those were even tagged, just switching their use will be enough.

@zikaeroh
Copy link
Contributor

The other thing I had been thinking about was if it would be worth it to remove go.mod (maybe in some branch), tag a newer v4 (for +incompatible usage), then make the jump to go.mod in a v5 commit. I know there was some code that was intended to be released for everyone, but the downgrade behavior prevented people from using it. Doing so may be beneficial to existing users before they make the change to get v5. I'm not experienced in doing that sort of switch up (to go.mod, away from go.mod, back again, etc), but I think some repos like gofrs/uuid had done something like this previously.

If you're comfortable with the contents of the old v4 release, then that's alright too.

@pkieltyka
Copy link
Member

pkieltyka commented Feb 28, 2021

chi v5 is out -- https://github.com/go-chi/chi/releases/tag/v5.0.0

please let me know if there are any issues

I must admit though, now that I’ve been updating some of my projects to chi v5, I really don’t like it and confirms my original distaste of forced SIV and hassle of all the tooling around it — especially as there is never a good reason to have multiple versions of chi in a single project.

@umputun
Copy link
Author

umputun commented Feb 28, 2021

Upgraded a few project to v5 and it worked fine, nothing unexpected. Thx!

@zikaeroh
Copy link
Contributor

zikaeroh commented Feb 28, 2021

The code in _examples needs to be updated to v5; without it you still seem to end up with the non-v5 path downloaded.

EDIT: Hmm, no, I was wrong (it's just from another dep in my dependency graph), but the code there does need to be updated. 🙂

@pkieltyka
Copy link
Member

pkieltyka commented Feb 28, 2021

The code in _examples needs to be updated to v5; without it you still seem to end up with the non-v5 path downloaded.
EDIT: Hmm, no, I was wrong (it's just from another dep in my dependency graph), but the code there does need to be updated.

@zikaeroh what do you mean? https://github.com/go-chi/chi/blob/master/_examples/hello-world/main.go#L6-L7

..lol, just shows how poor of a developer experience SIV is, that you're mistakenly loading two versions at once when clearly this is never intended. We must do better with Go modules. I think its time I start learning Rust.. chi.rs is coming, stay tuned :)

@pkieltyka
Copy link
Member

#592 (comment)

@pkieltyka
Copy link
Member

pkieltyka commented Feb 28, 2021

I'd like to point out within < 1 day, the basic issues others have with using a package which adopts SIV. The user's intuition isn't the problem here, nor is it my responsibility to be customer support for everyone's project trying to teach them how to use SIV. The problem is with Go's module system and tools.

To me, software is art, and I intentionally spent so much time to craft chi to the create a router with the absolute best ergonomics and developer experience. With forced-SIV, I'm unable to fulfill this purpose.

@zikaeroh
Copy link
Contributor

zikaeroh commented Feb 28, 2021

The code in _examples needs to be updated to v5; without it you still seem to end up with the non-v5 path downloaded.
EDIT: Hmm, no, I was wrong (it's just from another dep in my dependency graph), but the code there does need to be updated.

@zikaeroh what do you mean? https://github.com/go-chi/chi/blob/master/_examples/hello-world/main.go#L6-L7

..lol, just shows how poor of a developer experience SIV is, that you're mistakenly loading two versions at once when clearly this is never intended. We must do better with Go modules. I think its time I start learning Rust.. chi.rs is coming, stay tuned :)

There are a few others, I will happily send a PR.

#592 to me very much sounds like a GoLand bug; it should work fine with modules and I am sure existing codebases would have hit this for that user.

The s3-proxy appears to be a bug in the "renovate" tool; this is some third-party dependency upgrader that doesn't appear to understand SIV and should do better. It seems like https://github.com/renovatebot/renovate/discussions is the place to report issues, but GitHub's search kind of sucks and it's hard to tell if it's been reported already.

EDIT: It is. Just in the real "issues" (their marketplace entry links to "discussions").

@zikaeroh
Copy link
Contributor

FWIW, https://github.com/marwan-at-work/mod is a tool suggested at https://github.com/golang/go/wiki/Modules#releasing-modules-v2-or-higher for automating this process. It's my belief that this tool is likely to be absorbed into golang.org/x/exp/cmd/gorelease (which is intended to eventually be go release). But I know this only helps with one side of the SIV story, the library author.

@zikaeroh
Copy link
Contributor

zikaeroh commented Feb 28, 2021

Actually, https://github.com/marwan-at-work/mod lets you use it as a consumer to quickly get a new version of a module.

$ mod upgrade --mod-name=github.com/go-chi/chi --tag=5
$ git diff
diff --git a/internal/cli/subcommands/graphql/graphql.go b/internal/cli/subcommands/graphql/graphql.go
index c9bd937..2d04b87 100644
--- a/internal/cli/subcommands/graphql/graphql.go
+++ b/internal/cli/subcommands/graphql/graphql.go
@@ -7,7 +7,7 @@ import (
 
 	"github.com/99designs/gqlgen/graphql/handler"
 	"github.com/99designs/gqlgen/graphql/playground"
-	"github.com/go-chi/chi"
+	"github.com/go-chi/chi/v5"
 	"github.com/hortbot/hortbot/internal/cli"
 	"github.com/hortbot/hortbot/internal/cli/flags/jaegerflags"
 	"github.com/hortbot/hortbot/internal/cli/flags/promflags"
diff --git a/internal/web/admin.go b/internal/web/admin.go
index 4fa9525..69d72e7 100644
--- a/internal/web/admin.go
+++ b/internal/web/admin.go
@@ -11,8 +11,8 @@ import (
 	"strings"
 	"time"
 
-	"github.com/go-chi/chi"
-	"github.com/go-chi/chi/middleware"
+	"github.com/go-chi/chi/v5"
+	"github.com/go-chi/chi/v5/middleware"
 	"github.com/hortbot/hortbot/internal/confimport"
 	"github.com/hortbot/hortbot/internal/pkg/dbx"
 	"github.com/hortbot/hortbot/internal/pkg/jsonx"

...

As does gomajor get:

$ gomajor get github.com/go-chi/chi/v5
go get github.com/go-chi/chi/v5
go get: added github.com/go-chi/chi/v5 v5.0.0
internal/cli/subcommands/graphql/graphql.go: github.com/go-chi/chi -> github.com/go-chi/chi/v5
internal/web/admin.go: github.com/go-chi/chi -> github.com/go-chi/chi/v5
internal/web/admin.go: github.com/go-chi/chi/middleware -> github.com/go-chi/chi/v5/middleware
internal/web/api_v1.go: github.com/go-chi/chi -> github.com/go-chi/chi/v5
internal/web/debug.go: github.com/go-chi/chi -> github.com/go-chi/chi/v5
internal/web/debug.go: github.com/go-chi/chi/middleware -> github.com/go-chi/chi/v5/middleware
internal/web/middleware.go: github.com/go-chi/chi -> github.com/go-chi/chi/v5
internal/web/web.go: github.com/go-chi/chi -> github.com/go-chi/chi/v5
internal/web/web.go: github.com/go-chi/chi/middleware -> github.com/go-chi/chi/v5/middleware

@umputun
Copy link
Author

umputun commented Feb 28, 2021

I'd like to point out within < 1 day, the basic issues others have with using a package which adopts SIV.

I would say this is because users upgrading to v5 successfully and uneventfully won't post success stories. This is expected, supposed to work, and, in practice, works well enough.

In all 3 examples, you posted above, this was clearly the user's error or the side effect of the previous downgrade. As with any non-trivial system go mod expects users to understand the basics and not trying to solve problems magically for everyone.

I will most likely archive go-chi/chi and create a new repository at go-chi/mux and start from v0 and never leave it.

Well, this is sad news as it means a dramatic change for users and a lack of stability from the user's point of view. If from v0.1.0 to v0.2.0 compatibility changed "go get chi" will happily upgrade to the next "major" version potentially breaking user's code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests