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 random seed initialization. #820

Conversation

xuezhaojun
Copy link
Member

@xuezhaojun xuezhaojun commented Feb 1, 2025

Summary

This PR removes explicit calls to rand.Seed(time.Now().UTC().UnixNano()) from multiple command entry points. As of Go 1.20, explicit seeding is unnecessary since the package is auto-initialized. This change removes the now-deprecated code and associated imports, cleaning up our codebase.

Go 1.20 no longer requires developers to manually seed the random number generator for typical operations. Removing these calls:

  • Eliminates deprecation warnings.
  • Simplifies the main functions.
  • Reduces unnecessary code.
    If deterministic random sequences are needed (for testing, for example), consider using rand.New(rand.NewSource(seed)) to initialize a local generator.

@openshift-ci openshift-ci bot requested review from deads2k and qiujian16 February 1, 2025 02:46
@xuezhaojun
Copy link
Member Author

/assign @qiujian16

Copy link

codecov bot commented Feb 1, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 63.82%. Comparing base (b6c2a84) to head (88067f5).
Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #820   +/-   ##
=======================================
  Coverage   63.82%   63.82%           
=======================================
  Files         193      193           
  Lines       18667    18667           
=======================================
  Hits        11914    11914           
  Misses       5772     5772           
  Partials      981      981           
Flag Coverage Δ
unit 63.82% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

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

@qiujian16
Copy link
Member

/approve
/lgtm

@openshift-ci openshift-ci bot added the lgtm label Feb 5, 2025
Copy link
Contributor

openshift-ci bot commented Feb 5, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: qiujian16, xuezhaojun

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci bot added the approved label Feb 5, 2025
@openshift-merge-bot openshift-merge-bot bot merged commit 424eb11 into open-cluster-management-io:main Feb 5, 2025
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants