Skip to content

Commit

Permalink
Fix: remove deprecated rand (openyurtio#1320)
Browse files Browse the repository at this point in the history
Signed-off-by: fengshunli <1171313930@qq.com>
  • Loading branch information
fengshunli authored Mar 21, 2023
1 parent 76f1a35 commit 7fe2079
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 4 deletions.
8 changes: 8 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -196,3 +196,11 @@ GOBIN=$(PROJECT_DIR)/bin go install $(2) ;\
rm -rf $$TMP_DIR ;\
}
endef


fmt:
go fmt ./...
find . -name '*.go' | grep -Ev 'vendor|thrift_gen' | xargs goimports -w

vet:
GO111MODULE=${GO_MODULE} go list ./... | grep -v "vendor" | xargs go vet
3 changes: 2 additions & 1 deletion cmd/yurt-controller-manager/controller-manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ import (
)

func main() {
rand.Seed(time.Now().UnixNano())
newRand := rand.New(rand.NewSource(time.Now().UnixNano()))
newRand.Seed(time.Now().UnixNano())

command := app.NewControllerManagerCommand()

Expand Down
3 changes: 2 additions & 1 deletion cmd/yurt-manager/yurt-manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ import (
)

func main() {
rand.Seed(time.Now().UnixNano())
newRand := rand.New(rand.NewSource(time.Now().UnixNano()))
newRand.Seed(time.Now().UnixNano())

command := app.NewYurtManagerCommand()

Expand Down
3 changes: 2 additions & 1 deletion cmd/yurt-node-servant/node-servant.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ import (
// running on specific node, do convert/revert job
// node-servant convert/revert join/reset, yurtcluster operator shall start a k8s job to run this.
func main() {
rand.Seed(time.Now().UnixNano())
newRand := rand.New(rand.NewSource(time.Now().UnixNano()))
newRand.Seed(time.Now().UnixNano())

version := fmt.Sprintf("%#v", projectinfo.Get())
rootCmd := &cobra.Command{
Expand Down
4 changes: 3 additions & 1 deletion cmd/yurthub/yurthub.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ import (
)

func main() {
rand.Seed(time.Now().UnixNano())
newRand := rand.New(rand.NewSource(time.Now().UnixNano()))
newRand.Seed(time.Now().UnixNano())

cmd := app.NewCmdStartYurtHub(server.SetupSignalContext())
cmd.Flags().AddGoFlagSet(flag.CommandLine)
if err := cmd.Execute(); err != nil {
Expand Down

0 comments on commit 7fe2079

Please sign in to comment.