'How to scan keys from redis using golang using "SCAN" not "KEYS"

This is My Code

redisPool := redis.NewPool(func() (redis.Conn, error) {
        con, err := redis.Dial("tcp", *redisAddress)
        con.Do("SELECT", 0)
        if err != nil {
            return nil, err
        }
        return con, err
    }, *maxConnections)
    fmt.Println("Redis Connection Establ...!")
    con := redisPool.Get()
    data, err1 := con.Do("scan", "0")
    //data, err1 := con.Do("KEYS", "*")
    if err1 != nil {
        fmt.Println(err1)
    } else {
        fmt.Println(reflect.TypeOf(data))
        fmt.Println(data)
    }

my output is not coming in string



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source