From 96662df62fe224ba87c76c781774dcd6b692ef81 Mon Sep 17 00:00:00 2001 From: gribanoid <82345280+gribanoid@users.noreply.github.com> Date: Mon, 10 Apr 2023 18:34:10 +0300 Subject: [PATCH] fix(math): double method call (#15768) ## Description The `init` method of the `Rand` struct was called twice: in the constructor and in the `init` function. Closes: #XXXX --- ### Author Checklist *All items are required. Please add a note to the item if the item is not applicable and please add links to any relevant follow up issues.* I have... * [ ] included the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title * [ ] added `!` to the type prefix if API or client breaking change * [ ] targeted the correct branch (see [PR Targeting](https://github.com/cosmos/cosmos-sdk/blob/main/CONTRIBUTING.md#pr-targeting)) * [ ] provided a link to the relevant issue or specification * [ ] followed the guidelines for [building modules](https://github.com/cosmos/cosmos-sdk/blob/main/docs/docs/building-modules) * [ ] included the necessary unit and integration [tests](https://github.com/cosmos/cosmos-sdk/blob/main/CONTRIBUTING.md#testing) * [ ] added a changelog entry to `CHANGELOG.md` * [ ] included comments for [documenting Go code](https://blog.golang.org/godoc) * [ ] updated the relevant documentation or specification * [ ] reviewed "Files changed" and left comments if necessary * [ ] confirmed all CI checks have passed ### Reviewers Checklist *All items are required. Please add a note if the item is not applicable and please add your handle next to the items reviewed if you only reviewed selected items.* I have... * [ ] confirmed the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title * [ ] confirmed `!` in the type prefix if API or client breaking change * [ ] confirmed all author checklist items have been addressed * [ ] reviewed state machine logic * [ ] reviewed API design and naming * [ ] reviewed documentation is accurate * [ ] reviewed tests and test coverage * [ ] manually tested (if applicable) --- math/CHANGELOG.md | 4 ++++ math/unsafe/rand.go | 1 - 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/math/CHANGELOG.md b/math/CHANGELOG.md index e6d8dbc285..df0d947b0f 100644 --- a/math/CHANGELOG.md +++ b/math/CHANGELOG.md @@ -40,6 +40,10 @@ Ref: https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.j * [#15714](https://github.com/cosmos/cosmos-sdk/pull/15714) `FormatInt` returns an error on empty string +### Improvements + +* [#15768](https://github.com/cosmos/cosmos-sdk/pull/15768) Removed the second call to the `init` method for the global variable `grand`. + ## [math/v1.0.0](https://github.com/cosmos/cosmos-sdk/releases/tag/math/v1.0.0) - 2023-03-23 ### Bug Fixes diff --git a/math/unsafe/rand.go b/math/unsafe/rand.go index e7fb3c44b3..66d48ae4dc 100644 --- a/math/unsafe/rand.go +++ b/math/unsafe/rand.go @@ -26,7 +26,6 @@ var grand *Rand func init() { grand = NewRand() - grand.init() } func NewRand() *Rand {