Skip to content

chore: prefer chan struct{} over chan bool for signalling - #733

Merged
sonmezonur merged 1 commit into
peak:masterfrom
sonmezonur:chan_struct_over_bool
Jul 4, 2024
Merged

sonmezonur merged 1 commit into
peak:masterfrom
sonmezonur:chan_struct_over_bool

Conversation

@sonmezonur

@sonmezonur sonmezonur commented Jul 4, 2024

Copy link
Copy Markdown
Member

Prefer using chan struct{} since:

  • We are not interested in value being passed to channel, it is just used for signaling
  • It occupies zero memory (bool:64bit)
  • We used chan struct{} and chan bool interchangeably. To maintain a standard in the codebase, let's only use chan struct.

@sonmezonur
sonmezonur requested review from a team, ilkinulas and seruman and removed request for a team July 4, 2024 12:03
@sonmezonur
sonmezonur merged commit 8355901 into peak:master Jul 4, 2024
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.

3 participants