elliotchance / redismock

🕋 Mocking Redis in unit tests in Go.
MIT License
147 stars 24 forks source link

go get install errors #12

Open fhquthpdw opened 5 years ago

fhquthpdw commented 5 years ago

Hi, When I install it by comamnd: go get github.com/elliotchance/redismock

show me an error list then can not install successful ../github.com/elliotchance/redismock/cmdable.go:135:26: cannot use db (type int64) as type int in argument to m.client.client.cmdable.Migrate ../github.com/elliotchance/redismock/cmdable.go:143:23: cannot use db (type int64) as type int in argument to m.client.client.cmdable.Move ../github.com/elliotchance/redismock/z_cmd.go:51:23: cannot use members (type []redis.Z) as type []redis.Z in argument to m.client.client.cmdable.ZAdd ../github.com/elliotchance/redismock/z_cmd.go:59:25: cannot use members (type []redis.Z) as type []redis.Z in argument to m.client.client.cmdable.ZAddNX ../github.com/elliotchance/redismock/z_cmd.go:67:25: cannot use members (type []redis.Z) as type []redis.Z in argument to m.client.client.cmdable.ZAddXX ../github.com/elliotchance/redismock/z_cmd.go:75:25: cannot use members (type []redis.Z) as type []redis.Z in argument to m.client.client.cmdable.ZAddCh ../github.com/elliotchance/redismock/z_cmd.go:83:27: cannot use members (type []redis.Z) as type []redis.Z in argument to m.client.client.cmdable.ZAddNXCh ../github.com/elliotchance/redismock/z_cmd.go:91:27: cannot use members (type []redis.Z) as type []redis.Z in argument to m.client.client.cmdable.ZAddXXCh ../github.com/elliotchance/redismock/z_cmd.go:99:24: cannot use member (type redis.Z) as type redis.Z in argument to m.client.client.cmdable.ZIncr ../github.com/elliotchance/redismock/z_cmd.go:107:26: cannot use member (type redis.Z) as type redis.Z in argument to m.client.client.cmdable.ZIncrNX ../github.com/elliotchance/redismock/z_cmd.go:107:26: too many errors

elliotchance commented 5 years ago

I have not updated the repo to use go modules yet. I suspect those errors are because of the github.com/go-redis/redis version you have installed. Try installing the specific version with dep first:

dep ensure github.com/go-redis/redis@6.15.3
go get -u go get github.com/elliotchance/redismock
hom-bahrani commented 4 years ago

I followed the advice in the answer and this is working ok for me