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

Switch to gofrs/uuid #52

Merged
merged 3 commits into from
Oct 9, 2020
Merged

Switch to gofrs/uuid #52

merged 3 commits into from
Oct 9, 2020

Conversation

kwontae
Copy link
Contributor

@kwontae kwontae commented Oct 8, 2020

This is to fix WS-2018-0594.
Satori/go.uuid doesn't seem to be maintained. However, there is a fork repo, gofrs/uuid which is being well-maintained. Aks-engine folks have done this as well.

Fix #51 .

For significant contributions please make sure you have completed the following items:

  • Design discussion issue #
  • Changes in public surface reviewed
  • CHANGELOG.md updated

@kwontae
Copy link
Contributor Author

kwontae commented Oct 8, 2020

@jjjordanmsft Can you review this when you have time?

@jjjordanmsft
Copy link
Contributor

Can you address a few things now that we have a sane generator? (This is not your doing but imo, necessary to complete the change):

  • Call the standard generator here instead - and use the fallback code in case err is set. (With the way this is written, this function can not fail).
  • Set variant and version only in the case of fallback. Also fix the typo where it should be SetVariant.
  • I don't think we need to keep the reader in the uuidGenerator struct anymore, but it's still needed to seed the fallback.

Thanks!

…he fallback, SetVersion, and SetVariant in case of err
@kwontae
Copy link
Contributor Author

kwontae commented Oct 9, 2020

@jjjordanmsft
I wasn't sure what you meant by calling the standard generator, but I assumed you meant calling the provided uuid.NewV4() function instead of using the Contract directly.

I was wondering if I could actually move the

u.SetVersion(uuid.V4)
u.SetVariant(uuid.VariantRFC4122)

to inside the function fallback(u *uuid.UUID){...} after the gen.fallbackRand.Read(u[:])

@jjjordanmsft
Copy link
Contributor

@kwontae Sorry I wasn't clear, but yes this is exactly what I meant. And yes, it probably makes sense to factor the Set* into fallback, if you'd like. Thanks!

@kwontae
Copy link
Contributor Author

kwontae commented Oct 9, 2020

@jjjordanmsft no worries :) Glad I didn't make an incorrect assumption. Factored the Set* into fallback as I think it makes more sense to be there.

@jjjordanmsft jjjordanmsft merged commit c513ad4 into microsoft:master Oct 9, 2020
@jjjordanmsft
Copy link
Contributor

Thanks!

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

Successfully merging this pull request may close these issues.

WS-2018-0594 with satori/go.uuid
2 participants