analytics-go icon indicating copy to clipboard operation
analytics-go copied to clipboard

Go mod incompatibility

Open AndrewBurian opened this issue 5 years ago • 8 comments

There is a small issue in the versioning of this repo causing go mod to think it incompatible with versioning.

If you look here in the godocs you can see go only officially recognizes the default v1 on the master branch, and a v3.1.0+incompatible.

Go mod supports two versioning strategies, either subdirectories or branches. This repo uses branches just fine, but on the v3 branch you need to have the mod file mark the project as v3 by adding /v3 suffix to the module name. Then imports will import the project as import github.com/segmentio/analytics-go/v3.

Obviously this dates back to before Go really had modules sorted out, so this is more a modernization than a bug.

Fix: change to go.mod to be module github.com/segmentio/analytics-go/v3. It's annoying but that is how the gomod do

I don't believe this will break anyone using the gopkg.in import recommended currently in the docs, and will enable people to use the direct import with full proper versions.

AndrewBurian avatar Nov 19 '20 06:11 AndrewBurian

Almost one year and still not fixed :( @tj @f2prateek

mimol91 avatar Sep 29 '21 06:09 mimol91

Hi @mimol91 & @AndrewBurian. This fix is high on our priority list. I will circle back once its complete. Apologies for the delay :)

prayansh avatar Oct 12 '21 22:10 prayansh

@prayansh: I saw you released a fix (https://github.com/segmentio/analytics-go/pull/178). Would y'all be able to release a new tag, too?

colinking avatar Dec 01 '21 22:12 colinking

still having issue:

go get gopkg.in/segmentio/analytics-go.v3


go: gopkg.in/segmentio/[email protected]: parsing go.mod:
        module declares its path as: github.com/segmentio/analytics-go/v3
                but was required as: gopkg.in/segmentio/analytics-go.v3
go version go1.18.2 darwin/arm64

guiaramos avatar May 31 '22 15:05 guiaramos

problem is analytics-go.v3 is not valid. Version requires it as analytics-go/v3

But kind of chicken-egg, gopkg.io needs be fixed up to new form but I guess that won't happen until it is fixed up here. I don't know the connections of how a github package gets mirrored into gopkg.in.

rlk833 avatar Jun 08 '22 18:06 rlk833

still not working :(

alvaradojl avatar Feb 11 '23 20:02 alvaradojl

Any update on this? I'd like to start using Segment but this is a blocker 😢

locnguyen avatar Mar 06 '23 23:03 locnguyen

Our workaround is to switch to github repo directly by using

github.com/segmentio/analytics-go/v3

instead of gopkg.in since that just doesn't work.

rlk833 avatar Mar 06 '23 23:03 rlk833