-
Notifications
You must be signed in to change notification settings - Fork 240
Closed
Description
Description
There is an error occurring while setting the response protocol of Redis to RESP3 via a Lua script in the main.go file.
Steps to Reproduce
- Start a
miniredisserver. - Connect to the
miniredisserver with RESP3. - Run the Lua script to set the response protocol.
Code
package main
import (
"context"
"fmt"
"github.com/alicebob/miniredis/v2"
"github.com/redis/go-redis/v9"
)
func main() {
// Start a miniredis server
mr, err := miniredis.Run()
if err != nil {
fmt.Printf("error in starting miniredis: %s\n", err)
return
}
defer mr.Close()
// Connect to the miniredis server with RESP3
redisClient := redis.NewClient(&redis.Options{
Addr: mr.Addr(),
Protocol: 3,
})
luaScript := `-- Use RESP3
redis.setresp(3)`
// Run the lua script
res, err := redis.NewScript(luaScript).Run(context.Background(), redisClient, []string{}).Result()
if err != nil {
fmt.Printf("error in setting the response protocol: %s\n", err)
return
}
fmt.Println("Response: ", res)
}Expected Behavior
The Lua script should set the response protocol to RESP3 without any errors.
Actual Behavior
The below error occurs while setting the response protocol.
ERR Error compiling script (new function): :2: attempt to call a non-function object stack traceback: :2: in main chunk [G]: ?
Environment
- Go version: 1.23.4
github.com/alicebob/miniredis/v2version: v2.34.0github.com/redis/go-redis/v9version: v9.7.0
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels