darccio / mergo

Mergo: merging Go structs and maps since 2013
BSD 3-Clause "New" or "Revised" License
2.89k stars 271 forks source link

Vanity url doesn't redirect to github repo #245

Closed andig closed 1 year ago

andig commented 1 year ago

Discussed in https://github.com/darccio/mergo/issues/244. It would be nice to do so to improve discoverability of this repo.

earthboundkid commented 1 year ago

A related issue: github.com/imdario/mergo@v1.0.0 was "published", but it is broken because it is actually dario.cat/mergo@v1.0.0. When it goes to compile, the Go tool notices the mismatch between the module name and the URL and stops compilation, but it still picks up github.com/imdario/mergo@v1.0.0 during the Go module resolution time, unfortunately.

What should happen instead is that the dario.cat/mergo releases should be separate from the old github.com/imdario/mergo releases. Ideally, github.com/imdario/mergo@v1.0.1 would be published with a retraction of github.com/imdario/mergo@v1.0.0 and itself github.com/imdario/mergo@v1.0.1.

In any event, as a workaround, I have added exclude github.com/imdario/mergo v1.0.0 to my go.mod file and that keeps it upgrading smoothly for now, but I will need to add v1.0.1 etc. for each new version of mergo until the projects that I depend on which depend on mergo have all moved to the vanity URL.

darccio commented 1 year ago

@carlmjohnson I'm not sure how the retraction would work. Would everybody have to revert to the github.com URL?

Keep in mind that I made this change to also switch my GitHub username.

earthboundkid commented 1 year ago

Because any version you tag ends up being available at both the old and new repo addresses, I'm not sure that there's any way to fix it. It would need to be published at just the old repo address but not the new one, and I'm not sure there's any way to do that.

lzap commented 1 year ago

Just saw this during our project update, is this just a warning?

go: github.com/imdario/mergo@v1.0.0: parsing go.mod:
    module declares its path as: dario.cat/mergo
            but was required as: github.com/imdario/mergo
darccio commented 1 year ago

@carlmjohnson After some consideration, I won't release a retraction. I think the best way forward is - when mergo isn't a direct dependency in your project - to recommend using replace instead:

replace github.com/imdario/mergo => github.com/imdario/mergo v0.3.16

@lzap You can fix that error using the replace directive or upgrading mergo if it's used directly in your code, just replacing the import URL to the one shown in your error.

The reason behind the decision is that Mergo is stable, with some quirks and improvements, but it's reasonable complete. So, I won't be adding new features, nor fixes as it works for lots of use cases. No new versions should pop up after v1.0.0.

PS: I updated my vanity URL to redirect to the docs, not the github repo cc @andig