Skip to content

Commit

Permalink
[occm] Reintroduce seeding of math/rand source (kubernetes#2121)
Browse files Browse the repository at this point in the history
* [occm] Revert seeding of math/rand source

In Go v1.20, `rand.Seed` is deprecated and `math/rand`'s is
automatically seeded. However, that doesn't happen in Go v1.19 that is
used to build this branch.

With this commit, the global source for `math/rand` is seeded again in
`main.go`.

* go-lint: Upgrade staticcheck to v0.4.2

which handles deprecations more gracefully.
  • Loading branch information
pierreprinetti authored and m-bull committed Feb 23, 2023
1 parent 7539289 commit b2abb59
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ build-cmd-%: work $(SOURCES)
test: unit functional

check: work
go run github.com/golangci/golangci-lint/cmd/golangci-lint@v1.51.1 run ./...
go run github.com/golangci/golangci-lint/cmd/golangci-lint@v1.51.2 run ./...

unit: work
go test -tags=unit $(shell go list ./... | sed -e '/sanity/ { N; d; }' | sed -e '/tests/ {N; d;}') $(TESTARGS)
Expand Down
2 changes: 1 addition & 1 deletion cmd/openstack-cloud-controller-manager/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ import (
)

func main() {
rand.NewSource(time.Now().UnixNano())
rand.Seed(time.Now().UnixNano())

ccmOptions, err := options.NewCloudControllerManagerOptions()
if err != nil {
Expand Down

0 comments on commit b2abb59

Please sign in to comment.