Skip to content

Make it a wrapper#5

Merged
brunomvsouza merged 1 commit intomainfrom
make-it-a-wrapper
May 30, 2025
Merged

Make it a wrapper#5
brunomvsouza merged 1 commit intomainfrom
make-it-a-wrapper

Conversation

@brunomvsouza
Copy link
Copy Markdown
Owner

@brunomvsouza brunomvsouza commented May 30, 2025

  • Easily verifiable
  • Easier to maintain

Important

The upstream lib now requires Go 1.23.

- Easily verifiable
- Easier to maintain
@brunomvsouza brunomvsouza requested a review from Copilot May 30, 2025 02:30
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR replaces the custom singleflight implementation with a generic, type‑safe wrapper around the upstream golang.org/x/sync/singleflight package for easier maintenance and verifiability.

  • Introduces a wrapper that supports generics with type constraint K ~string.
  • Updates go.mod and CI configurations to require Go 1.23 and newer versions of dependencies.
  • Removes legacy internal implementation and redundant examples in favor of consolidated usage examples.

Reviewed Changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
singleflight.go Replaces custom logic with a generic wrapper and adapts the API.
go.mod Updates Go version to 1.23.0 and adds required dependency.
examples_test.go Provides consolidated usage examples.
examples/Forget, examples/DoChan, examples/Do Remove redundant examples.
README.md Updates documentation to reflect the new wrapper design.
.github/workflows/ci.yaml Updates CI workflow for Go 1.24.x/1.23.x and related settings.
Comments suppressed due to low confidence (1)

singleflight.go:44

  • The conversion of key to string (using string(key)) relies on the new type constraint (K ~string). Please ensure this design decision is clearly documented so that users understand that only string-like types are accepted.
result, err, shared := g.group.Do(string(key), func() (any, error) {

@brunomvsouza brunomvsouza merged commit b25c858 into main May 30, 2025
3 checks passed
@brunomvsouza brunomvsouza deleted the make-it-a-wrapper branch May 30, 2025 02:33
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.

2 participants