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

proposal: crypto/uuid: add API to generate and parse UUID #62026

Open
mohamedattahri opened this issue Aug 14, 2023 · 3 comments
Open

proposal: crypto/uuid: add API to generate and parse UUID #62026

mohamedattahri opened this issue Aug 14, 2023 · 3 comments
Labels
Milestone

Comments

@mohamedattahri
Copy link
Contributor

mohamedattahri commented Aug 14, 2023

I would like to suggest the addition to the standard library of a package to generate and parse UUID identifiers, specifically versions 3, 4 and 5.

The main reason I see to include it is that the most popular 3rd-party package (github.com/google/uuid) is a staple import in every server/db based Go program, as confirmed by a quick Github code search.

Additionally:

Addendum

Would like to point out how Go is rather the exception than the norm with regards to including UUID support in its standard library.

@gopherbot gopherbot added this to the Proposal milestone Aug 14, 2023
@ALTree
Copy link
Member

ALTree commented Aug 14, 2023

Note that this has been asked -and rejected- in the past, here: #23789, and here #28324.

It's not clear what concrete, tangible benefits would bringing github.com/google/uuid in the standard library give us. Third-party packages are easy to import and use, and can have a more flexible release cycle than the standard library.

@mohamedattahri
Copy link
Contributor Author

mohamedattahri commented Aug 15, 2023

Guess the strongest argument is going to be that if you have to import it externally every time, it might as well be part of the standard library in the first place.

Pretty much every other language does, and tends to include it as part of its crypto library.

@mohamedattahri mohamedattahri changed the title proposal: add support for UUID to the standard library proposal: crypto/uuid: add API to generate and parse UUID Aug 16, 2023
@sergeyprokhorenko
Copy link

sergeyprokhorenko commented Nov 25, 2023

UUID versions 1, 2, 3, 4, 5 are already outdated. The latest and most promising version is 7. See https://datatracker.ietf.org/doc/draft-ietf-uuidrev-rfc4122bis/ However, version 7 allows for many different implementation options. It is necessary to wait for the results of applying various options.

6.12. Opacity
As general guidance, it is recommend to avoid parsing UUID values unnecessarily, and instead treating UUIDs as opaquely as possible. Although application-specific concerns could of course require some degree of introspection (e.g., to examine the Section 4.1, Section 4.2 or perhaps the timestamp of a UUID), the advice here is to avoid this or other parsing unless absolutely necessary. Applications typically tend to be simpler, more interoperable, and perform better, when this advice is followed.
Sourse: https://www.ietf.org/archive/id/draft-ietf-uuidrev-rfc4122bis-14.html#name-opacity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Incoming
Development

No branches or pull requests

4 participants