redistore icon indicating copy to clipboard operation
redistore copied to clipboard

fix compatibility with new go mod

Open Atrox opened this issue 6 years ago • 3 comments

Hey,

I had issues using redistore with go1.11rc1 because the go.mod is out of date and needs a "+incompatible" on the redigo library.

Atrox avatar Aug 15 '18 10:08 Atrox

Can you detail the “issues” - ?

I’d also like to understand the +incompatible syntax - it’s not documented anywhere in the modules docs.

elithrar avatar Aug 15 '18 12:08 elithrar

+incompatible is automatically getting added when the library, in that case gomodule/redigo, doesn't have a go.mod file. That tells go modules that there is no need for /v2 in the import path.

If I run go1.11rc1 get it will automatically fix this and add +incompatible to gomodule/redigo. That's the new way how "incompatible"/"non go.mod libraries" get imported.

The error you receive when using your library with the new go modules:

go: github.com/boj/[email protected]: parsing go.mod: go.mod:4: invalid module: github.com/gomodule/redigo should be v0 or v1, not v2 (v2.0.0)
go: error loading module requirements

In my go.mod, I currently replace your library with my fork and everything works flawlessly:

replace github.com/boj/redistore v0.0.0-20180706183828-82b86d293eb2 => github.com/atrox/redistore v0.0.0-20180815103755-672c9acd7598

Atrox avatar Aug 15 '18 12:08 Atrox

Ah - that makes sense. The official docs don't detail this appendix (yet?), hence the confusion.

elithrar avatar Aug 16 '18 21:08 elithrar