Skip to content

[BUG] unit test fails with Go 1.24 #983

Open

Description

@me-cs

Is there an existing issue for this?

  • 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.

Activity

  1. added a commit that references this issue on Apr 14, 2026
    cae7939
  2. alliasgher commented on Apr 14, 2026

    @alliasgher

    Opened #984 for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions