package calculate import ( "context" "fmt" "github.com/go-redis/redis/v8" ) var ctx = context.Background() func Calculate() { client := redis.NewClient(&redis.Options{ Addr: "mayimingperson.com:7000", Password: "", DB: 0, }) Pong, eror := client.Ping(ctx).Result() if eror != nil { fmt.Println("redis连接失败") } fmt.Println(Pong) }