From d3b4cc3b15ed30170612869b851328d21cb64356 Mon Sep 17 00:00:00 2001 From: Wenpeng Date: Fri, 1 Jul 2022 23:19:52 +0800 Subject: [PATCH] fix: correct do script error check (#563) Correct the error check in the Do method so it's more idiomatic. --- redis/script.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/redis/script.go b/redis/script.go index bb5d7b00..c585518b 100644 --- a/redis/script.go +++ b/redis/script.go @@ -79,7 +79,7 @@ func (s *Script) DoContext(ctx context.Context, c Conn, keysAndArgs ...interface // causing the script to load). func (s *Script) Do(c Conn, keysAndArgs ...interface{}) (interface{}, error) { v, err := c.Do("EVALSHA", s.args(s.hash, keysAndArgs)...) - if e, ok := err.(Error); ok && strings.HasPrefix(string(e), "NOSCRIPT ") { + if err != nil && strings.HasPrefix(err.Error(), "NOSCRIPT ") { v, err = c.Do("EVAL", s.args(s.src, keysAndArgs)...) } return v, err