Skip to content

Instantly share code, notes, and snippets.

@cipepser
Last active September 2, 2017 06:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cipepser/e6d4ca51b7b23914fadd5bdc0ec93c75 to your computer and use it in GitHub Desktop.
Save cipepser/e6d4ca51b7b23914fadd5bdc0ec93c75 to your computer and use it in GitHub Desktop.
package main
import (
"errors"
"fmt"
"os"
"github.com/garyburd/redigo/redis"
)
func main() {
// connect to redis
c, err := redis.Dial("tcp", ":6379")
if err != nil {
panic(err)
}
defer c.Close()
if len(os.Args) != 1 {
errors.New("please input artist name.")
}
rep, err := redis.Strings(c.Do("LRANGE", os.Args[1], "0", "-1"))
if err != nil || len(rep) == 0 {
fmt.Println("`", os.Args[1], "` is not found.")
} else {
for _, r := range rep {
fmt.Println(r)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment