Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x/website: release notes for Go 1.22 mentions inexistent math/rand/v2.Uint() #66693

Closed
rhcarvalho opened this issue Apr 5, 2024 · 6 comments
Closed
Assignees
Labels
Documentation Issues describing a change to documentation. NeedsFix The path to resolution is known, but the work has not been done. website
Milestone

Comments

@rhcarvalho
Copy link
Contributor

Go version

go version go1.22.2 linux/amd64

Output of go env in your module/workspace:

N/A

What did you do?

Read release notes at https://go.dev/doc/go1.22, highlights are mine:

The Intn, Int31, Int31n, Int63, and Int64n top-level functions and methods from math/rand are spelled more idiomatically in math/rand/v2: IntN, Int32, Int32N, Int64, and Int64N. There are also new top-level functions and methods Uint32, Uint32N, Uint64, Uint64N, Uint, and UintN.

What did you see happen?

Tried to use math/rand/v2.Uint, got a compilation error and realized it doesn't exist, and looking at the CLs that added math/rand/v2 it is possible it never existed, even tough it is mentioned in the original proposal.

What did you expect to see?

Either the release notes are wrong or the new package is missing intended functionality.

@gopherbot gopherbot added this to the Unreleased milestone Apr 5, 2024
@jfrech
Copy link

jfrech commented Apr 5, 2024

#61716 talks about adding it:

  1. Add Uint32, Uint32N, Uint64, Uint64N, Uint, UintN, both as top-level functions and methods on Rand. (...)

And the thread ends with the claim all would have been submitted for Go 1.22.

@dmitshur
Copy link
Contributor

dmitshur commented Apr 5, 2024

Thanks for reporting this.

CC @rsc.

@dmitshur dmitshur added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Apr 5, 2024
@adonovan adonovan self-assigned this Apr 11, 2024
@gopherbot
Copy link
Contributor

Change https://go.dev/cl/578295 mentions this issue: _content/doc/go1.22.html: remove nonexistent v2 rand.Uint

@dmitshur dmitshur added NeedsFix The path to resolution is known, but the work has not been done. Documentation Issues describing a change to documentation. and removed NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. labels Apr 11, 2024
@jfrech
Copy link

jfrech commented Apr 12, 2024

@adonovan Is your resolution motivated by compatibility to the already released Go 1.22 or have there been proposal changes not to include Uint?

@adonovan
Copy link
Member

adonovan commented Apr 12, 2024

@adonovan Is your resolution motivated by compatibility to the already released Go 1.22 or have there been proposal changes not to include Uint?

My change made the docs consistent with the code (ground truth), but you raise a good question: which was actually wrong? According to bullet point 9 of #61716, Uint was intended to be part of the new API, but seems to have been overlooked.

I'll let @rsc decide whether we should add (and document) a new Uint function.

@rsc
Copy link
Contributor

rsc commented May 6, 2024

I sent https://go.dev/cl/583455 to add Uint for Go 1.23.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Documentation Issues describing a change to documentation. NeedsFix The path to resolution is known, but the work has not been done. website
Projects
None yet
Development

No branches or pull requests

6 participants