Skip to content

chore: remove deprecated rand.Seed calls#339

Merged
fslongjin merged 1 commit into
TencentCloud:masterfrom
Piwriw:chore/remove-deprecated-rand-seed
May 25, 2026
Merged

chore: remove deprecated rand.Seed calls#339
fslongjin merged 1 commit into
TencentCloud:masterfrom
Piwriw:chore/remove-deprecated-rand-seed

Conversation

@Piwriw
Copy link
Copy Markdown
Contributor

@Piwriw Piwriw commented May 22, 2026

No description provided.

Signed-off-by: joohwan <piwriw@163.com>
@cubesandboxbot
Copy link
Copy Markdown

cubesandboxbot Bot commented May 22, 2026

Claude finished @Piwriw's task in 41s —— View job


PR #339 Review: chore: remove deprecated rand.Seed calls

Progress:

  • Gather context and analyze PR changes
  • Review code changes
  • Post review feedback

Review Summary

This is a straightforward cleanup removing deprecated rand.Seed() calls. The project uses Go 1.24.8, well past Go 1.20 where math/rand became automatically seeded, making explicit Seed() calls unnecessary.

Changes look correct:

  • CubeMaster/cmd/cubemaster/app/main.go (+0/-2): Removes "math/rand" import and rand.Seed(time.Now().UnixNano()) call. The "time" import is correctly retained since it's still used elsewhere (time.Now(), time.Since(), time.Duration, etc.).

  • CubeMaster/pkg/base/node/node_test.go (+0/-2): Removes "time" import (was only needed for the Seed() call) and pseudorand.Seed(time.Now().UnixNano()). The pseudorand "math/rand" import is correctly retained since pseudorand.Intn() and pseudorand.Float64() are still used in the same file.

No issues found. This is a clean, minimal change that eliminates the deprecation warnings that Go 1.20+ produces for rand.Seed() calls. Since Go 1.24 now seeds the global random source automatically with a random value, the behavior is equivalent — no runtime impact.

Copy link
Copy Markdown
Member

@fslongjin fslongjin left a comment

Choose a reason for hiding this comment

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

LGTM. Removing the deprecated global rand.Seed calls is consistent with the current Go 1.24 toolchain, and the related node randomness test passed locally.

@fslongjin fslongjin merged commit 7a5d487 into TencentCloud:master May 25, 2026
8 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