I am getting
dial : unknown network error
when i try to connect redis in go lang like this :
var client *redis.Client
client = redis.NewClient(&redis.Options{
Addr : "localhost:6379",
Password:"",
DB : 0,
});
Why i am getting this error,please help.
You're not providing a network parameter for the Dialer:
client := redis.NewClient(&redis.Options{
Network: "tcp",
Addr: "localhost:6379",
Password: "",
DB: 0,
})
Or use NewTCPClient
, which sets the "tcp" network parameter for you.