Consider package github.com/go-redis/redis/v8
; its path ends with v8
. So why, when we need to use function NewClient
from that package, do we write redis.NewClient
and not v8.NewClient
?
package main
import (
"github.com/go-redis/redis/v8"
)
func ExampleClient() {
rdb := redis.NewClient(&redis.Options{
Addr: "localhost:6379",
Password: "", // no password set
DB: 0, // use default DB
})
// do something with rdb
}