redis / go-redis

Redis Go client
https://redis.uptrace.dev
BSD 2-Clause "Simplified" License
20.06k stars 2.37k forks source link

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

Open Aden-Q opened 11 months ago

Aden-Q commented 11 months ago

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

szuecs commented 10 months ago

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

chayim commented 10 months ago

@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.

ofekshenawa commented 10 months ago

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

szuecs commented 9 months ago

Thanks!