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

feat: implement the version with generics #1

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft

Conversation

kevwan
Copy link
Owner

@kevwan kevwan commented Jan 6, 2022

No description provided.

@kevwan kevwan marked this pull request as draft January 6, 2022 10:35
@@ -3,25 +3,25 @@ package stream
import "sync"

// A Ring can be used as fixed size ring.
type Ring struct {
elements []interface{}
type Ring[T any] struct {
Copy link

Choose a reason for hiding this comment

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

🚫 [staticcheck] <compile> reported by reviewdog 🐶
expected ']', found any

index int
lock sync.Mutex
}

// NewRing returns a Ring object with the given size n.
func NewRing(n int) *Ring {
func NewRing[T any](n int) *Ring[T] {
if n < 1 {
Copy link

Choose a reason for hiding this comment

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

🚫 [staticcheck] <compile> reported by reviewdog 🐶
expected declaration, found 'if'

@kevwan kevwan linked an issue Jan 6, 2022 that may be closed by this pull request
@NicklasWallgren
Copy link

Is there anything preventing this PR from being merged?

@kevwan
Copy link
Owner Author

kevwan commented Apr 18, 2022

Is there anything preventing this PR from being merged?

Yes, go template doesn't support template method yet. Waiting for future releases.

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.

Proposal: implement the version with generics.
3 participants