Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove unnecessary nil check #380

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

knbr13
Copy link

@knbr13 knbr13 commented Feb 2, 2025

cmd/kaf/consume.go: remove unnecessay nil check.

var slice []byte
if slice != nil && len(slice) > 0 {}
// is the same as
if len(slice) > 0 {}

because len(slice) where slice == nil is always equal to 0,

staticcheck will highlight this optimization with the following message:

cmd/kaf/consume.go:354:6: should omit nil check; len() for []byte is defined as zero (S1009)

for reference: staticcheck S1009

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.

1 participant