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

Make structifyStream() channel types more explicit, e.g. input only #797

Merged
merged 1 commit into from
Oct 23, 2024

Conversation

Al2Klimov
Copy link
Member

@Al2Klimov Al2Klimov commented Sep 4, 2024

This enforces which side (caller/function) can read and especially close/write to a particular channel at compile time. That leaves less room for bugs (which had to be detected by tests otherwise).

@cla-bot cla-bot bot added the cla/signed label Sep 4, 2024
@Al2Klimov Al2Klimov requested a review from oxzi September 6, 2024 07:39
@yhabteab
Copy link
Member

yhabteab commented Sep 6, 2024

I don't understand what this change is supposed to achieve! Previously, nil channels were initialised and immediately closed, and with PR nil channels are assigned to a new closed one. So, which issue is this supposed to fix?

@julianbrost
Copy link
Contributor

I don't understand what this change is supposed to achieve!

Makes it more clear in the function signature, which channels are used for input and which for output.

Previously, nil channels were initialised and immediately closed, and with PR nil channels are assigned to a new closed one. So, which issue is this supposed to fix?

That probably became necessary as otherwise, once you assign a channel to upserted <-chan database.Entity for example, you can no longer close it using that <-chan reference. Therefore, it's assigned to a temporary variable, closed, then assigned to the final variable that no longer allows closing.

@lippserd lippserd self-requested a review October 2, 2024 10:04
Copy link
Member

@lippserd lippserd left a comment

Choose a reason for hiding this comment

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

Commit and PR description missing.

@yhabteab yhabteab added this to the 1.3.0 milestone Oct 22, 2024
@yhabteab yhabteab added the enhancement New feature or request label Oct 22, 2024
This enforces which side (caller/function) can read and especially
close/write to a particular channel at compile time.
That leaves less room for bugs (which had to be detected by tests otherwise).
@Al2Klimov Al2Klimov removed their assignment Oct 23, 2024
@yhabteab yhabteab merged commit 7214b28 into main Oct 23, 2024
32 checks passed
@yhabteab yhabteab deleted the structifyStream-iochan branch October 23, 2024 14:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla/signed enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants