go-redis icon indicating copy to clipboard operation
go-redis copied to clipboard

[Enhancement/Cleanup] Remove unused argument from `cmdSlot` function in osscluster

Open kapurm17 opened this issue 7 months ago • 1 comments

Description The cmdSlot function in the osscluster.go file accepts two parameters :

  1. context
  2. Cmder

The context argument is not being used in the the function and should be safe to remove.

Code Snippet:

func (c *ClusterClient) cmdSlot(ctx context.Context, cmd Cmder) int {
	args := cmd.Args()
	if args[0] == "cluster" && args[1] == "getkeysinslot" {
		return args[2].(int)
	}

	return cmdSlot(cmd, cmdFirstKeyPos(cmd))
}

CodeRef: https://github.com/redis/go-redis/blob/master/osscluster.go#L1814

What I expect to see?

  • Remove context from the cmdSlot function definition and all the instances where we are calling this from.

What version of go-redis are you using? checked the same on the master branch

kapurm17 avatar Jul 18 '24 10:07 kapurm17