refactor: consistently use one uuid library#40161
Conversation
the codebase is using a mix of github.com/google/uuid and github.com/gofrs/uuid Update the codebase to use github.com/gofrs/uuid consistently and bump to the current major version.
|
This pull request does not have a backport label.
To fixup this pull request, you need to add the backport labels for the needed
|
|
Is there a good argument for one over the other? The APIs look pretty similar, but there are some aspects of each that are not in the other, so one is not a drop in replacement for the other. |
|
Good point! I don't have a strong opinion on either. To be honest, I went with
Can you expand on this ? |
|
belimawr
left a comment
There was a problem hiding this comment.
So far the PR looks great! I don't have any strong preference about which library to use, but I like the fact that github.com/gofrs/uuid is community maintained.
|
@kruskall do you think it would be worth it to add the google/uuid to the gomodguard section of |
|
Pinging @elastic/obs-ds-hosted-services (Team:obs-ds-hosted-services) |
|
Pinging @elastic/sec-linux-platform (Team:Security-Linux Platform) |
|
Pinging @elastic/security-service-integrations (Team:Security-Service Integrations) |
|
Pinging @elastic/elastic-agent-data-plane (Team:Elastic-Agent-Data-Plane) |
|
Pinging @elastic/sec-deployment-and-devices (Team:Security-Deployment and Devices) |
efd6
left a comment
There was a problem hiding this comment.
It's a pity that this is mixed up with lint clean up.
| switch err { | ||
| case ErrFileTruncate: | ||
| switch { | ||
| case errors.Is(err, ErrFileTruncate): |
There was a problem hiding this comment.
I don't see any cases that these error values are returned wrapped so (disclaimer: as a non-owner) I'm not convinced of the value of this, but if this change is going to be made, the tests that look at error values should be updated to match (ErrInactive is the target of an exact value check).
| log := logp.NewLogger("metric_registry") | ||
| // Make an orthogonal ID to allow tracking register/deregister pairs. | ||
| uuid := uuid.New().String() | ||
| uuid := uuid.Must(uuid.NewV4()).String() |
There was a problem hiding this comment.
AFAICS crypto/rand.Reader hides EAGAIN so this should be OK.
|
@elastic/beats-tech-leads sorry for the ping, this only need one more review. Any help ? 🙏 |
Proposed commit message
consistently use one uuid library
the codebase is using a mix of github.com/google/uuid and github.com/gofrs/uuid Update the codebase to use github.com/gofrs/uuid consistently and bump to the current major version.
Checklist
CHANGELOG.next.asciidocorCHANGELOG-developer.next.asciidoc.Disruptive User Impact
Author's Checklist
How to test this PR locally
Related issues
Use cases
Screenshots
Logs