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

zset member returned as an interface type instead of a string and is not type-safe

Open Aden-Q opened this issue 1 year ago • 4 comments

Expected Behavior

According to the redis doc, zset members should always be strings. We want zset members to be returned as strings so that we don't have to do type assertion explicitly.

Current Behavior

zset member is returned as an interface: https://github.com/redis/go-redis/blob/21bd40a47e56e61c0598ea1bdf8e02e67d1aa651/sortedset_commands.go#L730

Possible Solution

Define the Z struct's member field as a string type: https://github.com/redis/go-redis/blob/21bd40a47e56e61c0598ea1bdf8e02e67d1aa651/sortedset_commands.go#L728-L731

Steps to Reproduce

Context (Environment)

Detailed Description

Possible Implementation

Aden-Q avatar Nov 29 '23 19:11 Aden-Q

@chayim why this was a bug? I would expect a breaking change only happens at major version updates.

szuecs avatar Jan 02 '24 10:01 szuecs

@szuecs Honest mistake frankly. Happens sometimes.

@ofekshenawa IMHO we need to revert accordingly and release a 9.4.0 due to this. I would minor the bugfix

If we feel this breaking matters - we can stack it up for future v10.

chayim avatar Jan 04 '24 12:01 chayim

Absolutely, I agree. We plan to release version 9.4.0 this Sunday, which will include the necessary fix.

ofekshenawa avatar Jan 04 '24 12:01 ofekshenawa

Thanks!

szuecs avatar Jan 04 '24 17:01 szuecs