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

chore(ginhelper): bump uuid to v8 #2895

Merged
merged 4 commits into from
Jul 19, 2024
Merged

chore(ginhelper): bump uuid to v8 #2895

merged 4 commits into from
Jul 19, 2024

Conversation

golangisfun123
Copy link
Collaborator

@golangisfun123 golangisfun123 commented Jul 18, 2024

Description
A clear and concise description of the features you're adding in this pull request.

Additional context
Add any other context about the problem you're solving.

Metadata

  • Fixes #[Link to Issue]

Summary by CodeRabbit

  • Chores

    • Updated Go version from 1.22 to 1.22.1 across various modules.
    • Added a new indirect dependency for UUID generation.
  • Refactor

    • Enhanced UUID generation by adopting a new library and versioning method.

Copy link
Contributor

coderabbitai bot commented Jul 18, 2024

Walkthrough

The overall changes involve updating several Go modules to utilize Go version 1.22.1 instead of 1.22 and replacing the github.com/google/uuid dependency with github.com/samborkent/uuid. This update also includes modifying UUID generation to version 8 in the core/ginhelper/server.go file. These modifications aim to enhance compatibility and take advantage of improvements and fixes introduced in Go 1.22.1 and the new UUID library.

Changes

File Path Change Summary
agents/go.mod Updated Go version to 1.22.1; added indirect dependency on github.com/samborkent/uuid.
contrib/git-changes-action/go.mod Updated Go version to 1.22.1; added indirect dependency on github.com/samborkent/uuid.
contrib/.../go.mod Updated Go version to 1.22.1; added indirect dependency on github.com/samborkent/uuid.
core/go.mod Updated Go version to 1.22.1; added dependency on github.com/samborkent/uuid.
tools/go.mod Updated Go version to 1.22.1.
core/ginhelper/server.go Replaced github.com/google/uuid with github.com/samborkent/uuid; set UUID version to 8.

Poem

In the realm of Go, a change did bloom,
From 1.22 to .1, with a new UUID tune.
Libraries swapped, versions anew,
With code refreshed, old bugs bid adieu.
Embracing updates, we code with glee,
Synapsecns strides forward, as we decree.


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions github-actions bot added go Pull requests that update Go code size/s labels Jul 18, 2024
Copy link

cloudflare-workers-and-pages bot commented Jul 18, 2024

Deploying sanguine-fe with  Cloudflare Pages  Cloudflare Pages

Latest commit: 080a001
Status:⚡️  Build in progress...

View logs

Copy link

codecov bot commented Jul 18, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 25.67207%. Comparing base (3ea8cb6) to head (080a001).
Report is 2 commits behind head on master.

Additional details and impacted files
@@                 Coverage Diff                 @@
##              master       #2895         +/-   ##
===================================================
+ Coverage   25.38787%   25.67207%   +0.28420%     
===================================================
  Files            785         770         -15     
  Lines          56527       55500       -1027     
  Branches          80          80                 
===================================================
- Hits           14351       14248        -103     
+ Misses         40695       39772        -923     
+ Partials        1481        1480          -1     
Flag Coverage Δ
git-changes-action 23.69615% <ø> (ø)
omnirpc 33.23904% <ø> (ø)
opbot 0.18293% <ø> (-0.00271%) ⬇️
promexporter ?
screener-api 29.29293% <ø> (ø)
tools 30.55118% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -96,6 +98,8 @@ func newBase() *gin.Engine {
MaxAge: 12 * time.Hour,
}))

uuid.SetVersion(8)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isn't this a global set?

Copy link
Collaborator Author

@golangisfun123 golangisfun123 Jul 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ya

SetVersion(int)

var currentVersion = defaultVersion

// SetVersion sets the version of the application.
//
// It takes an integer value representing the version and returns an error.
func SetVersion(version int) error {
	newVersion := Version(version)

	if newVersion != Version4 && newVersion != Version7 && newVersion != Version8 {
		return ErrInvalidVersion
	}

	currentVersion = newVersion

	return nil
}

then New()

func New() UUID {
	switch currentVersion {
	case Version4:
		return NewV4()
	case Version7:
		return NewV7()
	case Version8:
		return NewV8()
	default:
		return NewV7()
	}
}

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between bc7c012 and 67d7784.

Files ignored due to path filters (11)
  • agents/go.sum is excluded by !**/*.sum
  • contrib/opbot/go.sum is excluded by !**/*.sum
  • contrib/promexporter/go.sum is excluded by !**/*.sum
  • contrib/screener-api/go.sum is excluded by !**/*.sum
  • core/go.sum is excluded by !**/*.sum
  • ethergo/go.sum is excluded by !**/*.sum
  • services/cctp-relayer/go.sum is excluded by !**/*.sum
  • services/explorer/go.sum is excluded by !**/*.sum
  • services/omnirpc/go.sum is excluded by !**/*.sum
  • services/rfq/go.sum is excluded by !**/*.sum
  • services/scribe/go.sum is excluded by !**/*.sum
Files selected for processing (14)
  • agents/go.mod (2 hunks)
  • contrib/git-changes-action/go.mod (1 hunks)
  • contrib/opbot/go.mod (1 hunks)
  • contrib/promexporter/go.mod (2 hunks)
  • contrib/screener-api/go.mod (2 hunks)
  • core/ginhelper/server.go (2 hunks)
  • core/go.mod (2 hunks)
  • ethergo/go.mod (2 hunks)
  • services/cctp-relayer/go.mod (2 hunks)
  • services/explorer/go.mod (2 hunks)
  • services/omnirpc/go.mod (2 hunks)
  • services/rfq/go.mod (2 hunks)
  • services/scribe/go.mod (2 hunks)
  • tools/go.mod (1 hunks)
Files skipped from review due to trivial changes (2)
  • contrib/git-changes-action/go.mod
  • tools/go.mod
Additional context used
GitHub Check: Lint (core)
core/ginhelper/server.go

[failure] 101-101:
Error return value of uuid.SetVersion is not checked (errcheck)

Additional comments not posted (22)
core/ginhelper/server.go (1)

7-7: Import change approved.

The import change from github.com/google/uuid to github.com/samborkent/uuid is appropriate for the new UUID handling functionality.

core/go.mod (2)

3-3: Go version update approved.

The update from go 1.22 to go 1.22.1 is appropriate and aligns with the project requirements.


38-38: New dependency addition approved.

The addition of github.com/samborkent/uuid as a new dependency is appropriate for the new UUID handling functionality.

contrib/screener-api/go.mod (2)

3-3: Go version update approved.

The update from go 1.22 to go 1.22.1 is appropriate and aligns with the project requirements.


141-141: New dependency addition approved.

The addition of github.com/samborkent/uuid as a new dependency is appropriate for the new UUID handling functionality.

contrib/promexporter/go.mod (2)

3-3: Go version update approved.

The update from go 1.22 to go 1.22.1 is appropriate and aligns with the project requirements.


183-183: New dependency addition approved.

The addition of github.com/samborkent/uuid as a new dependency is appropriate for the new UUID handling functionality.

services/omnirpc/go.mod (2)

3-3: Update Go version.

The Go version has been updated from 1.22 to 1.22.1. This is a minor version update and should include bug fixes and minor improvements.


210-210: Add new indirect dependency.

A new indirect dependency on github.com/samborkent/uuid has been added. Ensure this new dependency is compatible with the existing codebase and does not introduce any breaking changes.

ethergo/go.mod (2)

3-3: Update Go version.

The Go version has been updated from 1.22 to 1.22.1. This is a minor version update and should include bug fixes and minor improvements.


236-236: Add new indirect dependency.

A new indirect dependency on github.com/samborkent/uuid has been added. Ensure this new dependency is compatible with the existing codebase and does not introduce any breaking changes.

services/explorer/go.mod (2)

3-3: Update Go version.

The Go version has been updated from 1.22 to 1.22.1. This is a minor version update and should include bug fixes and minor improvements.


227-227: Add new indirect dependency.

A new indirect dependency on github.com/samborkent/uuid has been added. Ensure this new dependency is compatible with the existing codebase and does not introduce any breaking changes.

contrib/opbot/go.mod (1)

217-217: Verify the necessity and compatibility of the new dependency.

The new dependency github.com/samborkent/uuid has been added. Ensure that this dependency is necessary and compatible with the existing codebase. Verify that it does not introduce any conflicts or issues.

Verification successful

The new dependency github.com/samborkent/uuid is necessary and compatible with the existing codebase.

The uuid dependency is used in core/ginhelper/server.go for setting the UUID version and generating new UUIDs. This confirms its necessity and compatibility.

  • core/ginhelper/server.go: Uses uuid.SetVersion(8) and uuid.New().String().
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the necessity and compatibility of the new dependency.

# Test: Search for the usage of the new dependency in the codebase. Expect: Usage of `github.com/samborkent/uuid`.
rg --type go -A 5 'github.com/samborkent/uuid'

Length of output: 357


Script:

#!/bin/bash
# Description: Verify the usage of the new dependency in the file where it is imported.

# Test: Search for the usage of `uuid` in `core/ginhelper/server.go`. Expect: Usage of `uuid` functions or methods.
rg --type go 'uuid' core/ginhelper/server.go

Length of output: 124

services/scribe/go.mod (2)

3-3: Go version update approved.

The Go version is correctly updated from 1.22 to 1.22.1.


245-245: New dependency addition approved.

The new indirect dependency on github.com/samborkent/uuid is correctly added.

services/cctp-relayer/go.mod (2)

3-3: Go version update approved.

The Go version is correctly updated from 1.22 to 1.22.1.


225-225: New dependency addition approved.

The new indirect dependency on github.com/samborkent/uuid is correctly added.

services/rfq/go.mod (2)

3-3: Go version update approved.

The Go version is correctly updated from 1.22 to 1.22.1.


256-256: New dependency addition approved.

The new indirect dependency on github.com/samborkent/uuid is correctly added.

agents/go.mod (2)

3-3: Go version update approved.

The Go version has been updated from 1.22 to 1.22.1. Ensure that the codebase is compatible with this version.


98-98: New indirect dependency approved.

A new indirect dependency on github.com/samborkent/uuid has been added. Ensure that this dependency is necessary and does not introduce any conflicts with existing dependencies.

@@ -96,6 +98,8 @@
MaxAge: 12 * time.Hour,
}))

uuid.SetVersion(8)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check the error return value of uuid.SetVersion.

The error return value of uuid.SetVersion(8) is not checked. This could lead to unhandled errors.

-  uuid.SetVersion(8)
+  if err := uuid.SetVersion(8); err != nil {
+    // Handle the error appropriately
+    log.Fatalf("Failed to set UUID version: %v", err)
+  }
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
uuid.SetVersion(8)
uuid.SetVersion(8)
if err := uuid.SetVersion(8); err != nil {
// Handle the error appropriately
log.Fatalf("Failed to set UUID version: %v", err)
}
Tools
GitHub Check: Lint (core)

[failure] 101-101:
Error return value of uuid.SetVersion is not checked (errcheck)

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 67d7784 and bc7b09d.

Files selected for processing (1)
  • core/ginhelper/server.go (2 hunks)
Files skipped from review as they are similar to previous changes (1)
  • core/ginhelper/server.go

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Summary

  • Bumped UUID library to version 8 across multiple go.mod and go.sum files.
  • Updated Go version to 1.22.1 in various modules.
  • Added new indirect dependency on github.com/samborkent/uuid.
  • Adjusted import order in core/ginhelper/server.go.
  • Ensure compatibility with the latest Go toolchain and UUID library.

25 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Summary

(updates since last review)

  • Updated UUID library to github.com/samborkent/uuid in core/ginhelper/server.go
  • Set UUID version to 8 with error suppression in core/ginhelper/server.go
  • No major changes found since last review

1 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between bc7b09d and 080a001.

Files selected for processing (2)
  • core/ginhelper/server.go (2 hunks)
  • core/go.mod (2 hunks)
Files skipped from review due to trivial changes (1)
  • core/go.mod
Files skipped from review as they are similar to previous changes (1)
  • core/ginhelper/server.go

@trajan0x trajan0x merged commit 1744778 into master Jul 19, 2024
65 of 67 checks passed
@trajan0x trajan0x deleted the bump-uuid branch July 19, 2024 20:52
Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Summary

(updates since last review)

  • Updated Go version to 1.22.1 in core/go.mod
  • Replaced github.com/google/uuid with github.com/samborkent/uuid in core/ginhelper/server.go
  • Enhanced EndSpanWithErr function in core/metrics/spanutils.go for better error reporting
  • Switched error handling to go.uber.org/multierr in core/retry/retry.go
  • Added new address to packages/synapse-interface/public/blacklist.json

9 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
go Pull requests that update Go code size/s
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants