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

fix: fix slice init length #4412

Merged
merged 4 commits into from
Oct 23, 2024
Merged

fix: fix slice init length #4412

merged 4 commits into from
Oct 23, 2024

Conversation

cuishuang
Copy link
Contributor

Description

The intention here should be to initialize a slice with a capacity of len(deviceArr) rather than initializing the length of this slice.

The online demo: https://go.dev/play/p/q1BcVCmvidW

Type of change

Please delete options that are not relevant.

  • [] Bug fix (non-breaking change which fixes an issue)
  • [] New feature (non-breaking change which adds functionality)
  • [] Code refactor or improvement
  • [] Breaking change (fix or feature that would cause a new or changed behavior of existing functionality)
  • [] This change requires a documentation update

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • [] make test
  • [] fullsync
  • [] Other test (please specify)

Test Configuration:

  • Firmware version:
  • Hardware:
  • Toolchain:
  • SDK:

Checklist:

  • [] My code follows the style guidelines of this project
  • [] I have performed a self-review of my code
  • [] I have commented my code, particularly in hard-to-understand areas
  • [] I have made corresponding changes to the documentation
  • [] My changes generate no new warnings
  • [] I have added tests that prove my fix is effective or that my feature works
  • [] New and existing unit tests pass locally with my changes
  • [] Any dependent changes have been merged and published in downstream modules

@CLAassistant
Copy link

CLAassistant commented Oct 4, 2024

CLA assistant check
All committers have signed the CLA.

@cuishuang
Copy link
Contributor Author

Thanks for the review. Anything need I to do?

Copy link
Member

@envestcc envestcc left a comment

Choose a reason for hiding this comment

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

Good catch, and curious about how to detect these issues?

@cuishuang
Copy link
Contributor Author

Good catch, and curious about how to detect these issues?

Thanks for your review.

I have encountered many similar cases and developed a tool. I submitted a proposal a few days ago. If you are interested, please take a look. golang/go#69872

Copy link

codecov bot commented Oct 22, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 74.73%. Comparing base (436e4d1) to head (50b73f8).
Report is 7 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4412      +/-   ##
==========================================
- Coverage   74.83%   74.73%   -0.11%     
==========================================
  Files         378      378              
  Lines       31624    31719      +95     
==========================================
+ Hits        23666    23704      +38     
- Misses       6747     6799      +52     
- Partials     1211     1216       +5     

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

Copy link

@envestcc envestcc merged commit 5e2cd1d into iotexproject:master Oct 23, 2024
4 of 5 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.

4 participants