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 #3517

Merged
merged 1 commit into from
Jan 21, 2025

Conversation

knbr13
Copy link
Contributor

@knbr13 knbr13 commented Jan 21, 2025

pubsub/pubsub.go:565: 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:

pubsub/pubsub.go:565:9: should omit nil check; len() for []*gocloud.dev/pubsub/driver.Message is defined as zero (S1009)

for reference: staticcheck S1009

Copy link

codecov bot commented Jan 21, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 73.25%. Comparing base (9e81e8d) to head (404f338).
Report is 2 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3517      +/-   ##
==========================================
- Coverage   73.26%   73.25%   -0.02%     
==========================================
  Files         113      113              
  Lines       15065    15065              
==========================================
- Hits        11038    11036       -2     
- Misses       3261     3263       +2     
  Partials      766      766              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@vangent vangent merged commit eaaf976 into google:master Jan 21, 2025
6 checks passed
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