Reputation: 157
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.
Upvotes: 0
Views: 4615
Reputation: 109447
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.
Upvotes: 6