Skip to content

proxy/sentry: fix exhaustive lint error in truncateValue#352

Merged
bootjp merged 3 commits intofeature/redis-proxyfrom
copilot/sub-pr-351
Mar 17, 2026
Merged

proxy/sentry: fix exhaustive lint error in truncateValue#352
bootjp merged 3 commits intofeature/redis-proxyfrom
copilot/sub-pr-351

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 17, 2026

The exhaustive linter rejected the switch rv.Kind() inside truncateValue because it requires all 26 reflect.Kind values to be explicitly listed as cases.

Change

Replace the inner switch rv.Kind() with if/else comparisons — same logic, no enum exhaustiveness requirement:

// before
switch rv.Kind() {
case reflect.Slice, reflect.Array:
    return formatSliceValue(rv, maxSentryValueLen)
case reflect.Map:
    return formatMapValue(rv, maxSentryValueLen)
default:
    return truncateString(fmt.Sprintf("%v", v))
}

// after
kind := rv.Kind()
if kind == reflect.Slice || kind == reflect.Array {
    return formatSliceValue(rv, maxSentryValueLen)
} else if kind == reflect.Map {
    return formatMapValue(rv, maxSentryValueLen)
}
return truncateString(fmt.Sprintf("%v", v))

📱 Kick off Copilot coding agent tasks wherever you are with GitHub Mobile, available on iOS and Android.

Copilot AI and others added 2 commits March 17, 2026 19:16
…stead of switch on reflect.Kind

Co-authored-by: bootjp <1306365+bootjp@users.noreply.github.com>
Co-authored-by: bootjp <1306365+bootjp@users.noreply.github.com>
Copilot AI changed the title [WIP] Add Redis proxy for dual-write with pub/sub forwarding proxy/sentry: fix exhaustive lint error in truncateValue Mar 17, 2026
Copilot AI requested a review from bootjp March 17, 2026 19:19
Comment thread proxy/sentry.go
switch rv.Kind() {
case reflect.Slice, reflect.Array:
kind := rv.Kind()
if kind == reflect.Slice || kind == reflect.Array {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [golangci] reported by reviewdog 🐶
QF1003: could use tagged switch on kind (staticcheck)

@bootjp bootjp marked this pull request as ready for review March 17, 2026 20:01
@bootjp bootjp merged commit 20c798f into feature/redis-proxy Mar 17, 2026
4 checks passed
@bootjp bootjp deleted the copilot/sub-pr-351 branch March 17, 2026 20:01
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