Reputation: 163
Hi,
I have made several redis and go tutorial sites. Most of the pages don't work. Here's a very simple one that doesn't work.
https://developer.redis.com/develop/golang/
And here is the error message.
# command-line-arguments
./main.go:17:29: too many arguments in call to client.cmdable.Ping
have (context.Context)
want ()
How to make the tutorial work?
Upvotes: 1
Views: 1195
Reputation: 564
What version of go-redis are you using? In version 8 it should work.
github.com/go-redis/redis/v8
.
See this example code on how to use it: https://github.com/go-redis/redis/blob/master/example_test.go
In v1
of go-redis
the function signature does not include context.Context
. See the code. You've most likely imported go redis without the v8 suffix, thus importing go-redis v1. (in go the v1 version of a library does not require the v...
suffix).
Upvotes: 2