Skip to content

fix(rueidiscompat): reject unsupported slice fields - #1031

Closed
fallintoplace wants to merge 1 commit into
redis:mainfrom
fallintoplace:fix/scan-unsupported-slices
Closed

fallintoplace wants to merge 1 commit into
redis:mainfrom
fallintoplace:fix/scan-unsupported-slices

Conversation

@fallintoplace

@fallintoplace fallintoplace commented Oct 4, 2026 •

Copy link
Copy Markdown

What

  • Return an error for unsupported slice fields in Scan.

Why

  • A field like []int keeps its old value while Scan returns success.

Implementation

  • Use the existing unsupported-type error.
  • Add cases for slice types, pointers, byte slices, and custom scanners.

Note

Medium Risk
Changes Scan from silent no-op to error for many slice field types, which may surface latent misuse but fixes incorrect success semantics.

Overview
Scan no longer reports success for slice fields it cannot decode. Only []byte / []uint8 still get the Redis string as raw bytes; other slice kinds (e.g. []int, []string, nested slices, named slice types, *[]int) now return redis.Scan(unsupported …) and leave the destination field unchanged.

Tests cover unsupported-slice errors and value preservation, byte-slice and pointer cases, and custom slice types that implement ScanRedis or UnmarshalText.

Reviewed by Cursor Bugbot for commit 610263a. Bugbot is set up for automated code reviews on this repo. Configure here.

Signed-off-by: Minh Vu <vuhoangminh97@gmail.com>
@rueian

rueian commented Oct 5, 2026

Copy link
Copy Markdown
Collaborator

Hi @fallintoplace, why do you need this? This doesn't seem to align with go-redis.

@fallintoplace

Copy link
Copy Markdown
Author

I think you are right, I will close this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants