redigo http://github.com/garyburd/redigo/redis
go redis client的一个库
如下代码:
package main
import(
"fmt"
"github.com/garyburd/redigo/redis"
)
func main(){
c, err := redis.Dial("tcp", ":6379")
c.Do("SET", "foo", "bar")
v, err := c.Do("GET", "foo")
if err != nil{
fmt.Println(err)
} else {
fmt.Println(v)
}
}
运行下,出错:
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x28 pc=0x2174]
goroutine 1 [running]:
main.main()
/Users/jay/mygo/src/golearn/rd2.go:9 +0x174
goroutine 2 [syscall]:
exit status 2
why? thanks
有疑问加站长微信联系(非本文作者)