websocket icon indicating copy to clipboard operation
websocket copied to clipboard

[BUG] unit test fails with Go 1.24

Open me-cs opened this issue 10 months ago • 0 comments

Is there an existing issue for this?

  • [x] I have searched the existing issues

Current Behavior

go test -v github.com/gorilla/websocket

=== RUN TestPreparedMessage prepared_test.go:71: write message != prepared message for {messageType:1 isServer:false enableWriteCompression:false compressionLevel:1} prepared_test.go:71: write message != prepared message for {messageType:1 isServer:false enableWriteCompression:true compressionLevel:1} prepared_test.go:71: write message != prepared message for {messageType:1 isServer:false enableWriteCompression:true compressionLevel:9} prepared_test.go:71: write message != prepared message for {messageType:9 isServer:false enableWriteCompression:false compressionLevel:1} prepared_test.go:71: write message != prepared message for {messageType:9 isServer:false enableWriteCompression:true compressionLevel:1} --- FAIL: TestPreparedMessage (0.00s)

Expected Behavior

The test passed successfully using go1.23.

Steps To Reproduce

1.Install the go1.24 environment 2.run go test -v github.com/gorilla/websocket 3.see the error

Anything else?

// Seed uses the provided seed value to initialize the default Source to a // deterministic state. Seed values that have the same remainder when // divided by 2³¹-1 generate the same pseudo-random sequence. // Seed, unlike the [Rand.Seed] method, is safe for concurrent use. // // If Seed is not called, the generator is seeded randomly at program startup. // // Prior to Go 1.20, the generator was seeded like Seed(1) at program startup. // To force the old behavior, call Seed(1) at program startup. // Alternately, set GODEBUG=randautoseed=0 in the environment // before making any calls to functions in this package. // // Deprecated: As of Go 1.20 there is no reason to call Seed with // a random value. Programs that call Seed with a known value to get // a specific sequence of results should use New(NewSource(seed)) to // obtain a local random generator. // // As of Go 1.24 [Seed] is a no-op. To restore the previous behavior set // GODEBUG=randseednop=0. func Seed(seed int64) { }

I think it's probably because go1.24 changed Seed to no-op.

me-cs avatar Apr 08 '25 08:04 me-cs