prepared_test: fix TestPreparedMessage for Go 1.20+#1018
Open
alliasgher wants to merge 1 commit intogorilla:mainfrom
Open
prepared_test: fix TestPreparedMessage for Go 1.20+#1018alliasgher wants to merge 1 commit intogorilla:mainfrom
alliasgher wants to merge 1 commit intogorilla:mainfrom
Conversation
The test reset the mask-random source by calling testRand.Seed(1234) on an existing *rand.Rand. rand.Rand.Seed was deprecated in Go 1.20 and its behaviour changed across minor versions, causing inconsistent masking between the direct write and the prepared-message write. Replace the approach: instead of calling Seed on a shared Rand, create a fresh rand.New(rand.NewSource(1234)) before each of the two writes. Both writes now use an identical, reproducibly-seeded generator so the masked bytes always match. Fixes gorilla#983 Signed-off-by: alliasgher <alliasgher123@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #983. rand.Rand.Seed was deprecated in Go 1.20 and its internal behaviour changed, causing inconsistent masks. Replace with fresh rand.New(rand.NewSource(1234)) before each write.