-
-
Notifications
You must be signed in to change notification settings - Fork 988
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
Add go.mod file #302
Comments
I'm down. What do you think @pkieltyka? |
I’m down too |
After doing some more reading (the dev and nuts golang mailing lists have some interesting conversations) I realize it isn't going to be so easy. (also see latest installment here: https://research.swtch.com/vgo-module) All internal references to go-chi would have to be changed to use a IE, from my understanding, everywhere where we currently do: import "github.com/go-chi/chi" Would have to change to: import "github.com/go-chi/v3/chi" That isn't THAT many places in the codebase, but would break non vgo users. So may make sense to give the paint some time to dry on this proposal to see what the community decides is the best practice for existing non v1 modules. |
Having pondered Russ's latest post a few minutes, I think the answer will be, create a |
I like the idea of minimal version selection and removing the distinction between lock and manifest files is great. But If every library needs to change then perhaps this idea needs more thought? |
I think this is a bit of a big bet by the go authors that we, the go ecosystem, need to take semantic versioning seriously, and that major version changes that aren't backwards compatible should be thought about carefully. The transition does indeed sound painful but I think there could be something really special to it if, especially if they follow through on their ideas of creating a That said, discussing the pros and cons of vgo belongs on the golang list more than here. |
I think I’ll hold off with chi until I have more time to dive into the subject. I’m a little busy at the moment with another project. I’ll let others take lead on this but since it’s so new I’d recommend to see how other packages adopt these ideas first |
Yep, I think that makes sense. For any brave explorers running in this in the future, you can add a chi dependency in your
|
From looking at https://github.com/peterbourgon/vmain and /vtest, I don't think the actual version folder is needed. |
It does if you want it to work across both go and vgo, because internal dependencies need to use the folder, ie this part: |
Chi could have new major release v4, which will address this "1 import path == 1 major version" requirement... |
@kron4eg ya that's probably the cleanest way forward. |
Just keep in mind that People where certain https://github.com/golang/go/wiki/vgo#current-state
|
vgo was just accepted: golang/go#24301 (comment) It's worth revisiting this issue. |
Import paths are changed according to Semantic Import Versions rationale. Otherwise `vgo test ./middleware` fails bacause of import path interpretation - it assumes that "github.com/go-chi/chi" points to v1, fails to find some public functions from v3 and dies. As semantic import versioning seems to be the official way, we should respect it. This is an experimental way of implementing go-chi#302 without major version bump. Backwards compatibility is done via `v3` symlink - old go is OK with it.
Hi, guys! I was experimenting a bit around vgo this days. I'm also looking forward adopting I played around the fork of Please take a look at my fork https://github.com/mwf/chi and a test project https://github.com/mwf/goplay/tree/master/vgo/chi There are two options for users:
What do you think about it? If it seems OK for you I'll be glad to make a PR :) |
Opened a PR in case you consider it a good way to go. |
golang/go#26238 is closed, and you can try
So we can add |
FYI, I added a comment golang/go#25967 (comment) to the go issue @VojtechVitek had spawned from this go-chi issue. In that comment I attempted to explain the new (and better!) behavior for a user using modules who needs to edit: sorry! I should have refreshed this issue page before adding my comment here. I now see @mwf just wrote a similar comment as mine here. |
So, as far as I understand, we need to stick with Personally, I'm fine with that for a while. |
Ref. #346 We will add We don't want to add it to For now, chi will live on |
We're going to add go.mod in chi v4 at #378. |
#302 was rejected by the main chi author. He doesn't like the idea of changing the import paths because of Go modules support (ie. |
The Gofrs are also of the same opinion after we bungled adding modules to one of our packages. @VojtechVitek @pkieltyka As an FYI, when your package version is greater than 1 you must do a major version bump to add modules support. Meaning it will need to be chi v5. We didn't realize this in the Gofrs and was what the bungled addition. We aren't comfortable forcing a major version bump for a still experimental feature. |
FWIW: It's going to be "finalized" for Go 1.13, which is due out this summer. |
@freeformz thanks for the note -- are there any changes to the modules sys in the "finalized" version? I'd rather avoid having to uglify the import path with a /v5 path for the sake of not showing +incompatible in the mod file |
Sadly, nope. Unless there is some miracle, I believe we're going to be stuck with the Modules system as it exists today. It's pretty disappointing. |
got it, so either the mod line is ugly, or the import path is ugly. I opt to have the mod line ugly if we're to settle on one. unless there are other benefits/reasons I'm not understanding to add a go.mod file ? |
Sadly, I'm pretty sure they've put a gun to your head and made this the only way to guarantee major version compatibility. I may need to think through this more, but I believe that without being in Modules if you bump a major version, and someone runs Edit: is it obvious Modules make me sad? Edit: I'm now thinking that maybe by putting a |
@theckman FWIW, I think you are right that a client of
I think you are also right that if a client manually puts something like For example, if a client is on |
Side note: enabling module mode by default for the go tool has been slowed down further compared to the prior plan of doing it in Go 1.13. As far as I am aware, the recently updated plan is now to enable module mode by default in 1.14, according to golang/go#31857. |
Ya, tooling is still pretty painful with modules honestly (the |
thanks for all the help everyone in figuring out the best approach. From the discussion in golang/go#31857 sounds like waiting for 1.14 will bring a better experience and more potential positive changes, so I'd like to wait until that settles |
FWIW: An import path of |
So what is the guidance now, if we are using modules? Stick with 3.3.2? Could some things get back-ported from 4+? Specifically, I am looking for updates in go-chi/jwtauth, but that seems to depend on chi v4. |
@carldunham I don't really use Modules, but maybe the replace statement will help? |
@theckman I'm just starting to dip my toes in, but just migrated a big work project to use modules for dependency management. Far different from the publisher side to be sure. So I did think about using |
you can use chi v4 with Go modules out of the box
will pull |
Indeed. Thanks, @VojtechVitek! |
Perhaps you've been following the discussion around the future of go dependency management?
https://research.swtch.com/vgo
Anyways, a few unrelated people, including me have tried to play with this experiment in our own projects and we are running into problems import chi due to it not having a
go.mod
file properly advertising the major version as v3.Any chance
chi
could partake in this experiment?I'm willing to give creating a proper chi
go.mod
file a go in a PR if so.The text was updated successfully, but these errors were encountered: