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

Remove done channel in client-server echo example #896

Closed
wants to merge 1 commit into from
Closed

Remove done channel in client-server echo example #896

wants to merge 1 commit into from

Conversation

CicadaCinema
Copy link

What type of PR is this? (check all applicable)

  • Refactor
  • Feature
  • Bug Fix
  • Optimization
  • Documentation Update
  • Go Version Update
  • Dependency Update

Description

I don't believe anything is actually sent to the done channel, in this example there are only statements reading from it. Furthermore, the deferred close(done) statement will never execute because deferred statements in other goroutines are not run when main terminates. So no messages will ever be sent to this channel and it will never be closed, so it is safe to remove all the references to done.

I took a look at 844dd6d , where done was introduced, and the situation was similar then, so I believe this is an oversight in that commit.

Related Tickets & Documents

None

Added/updated tests?

  • Yes
  • No, and this is why: I only slightly modified some code in an example application, and the functionality remains unaffected so there is nothing more to test
  • I need help with writing tests

Run verifications and test

  • make verify is passing
  • make test is passing

I didn't run these ^ .

Signed-off-by: CicadaCinema <52425971+CicadaCinema@users.noreply.github.com>
@CicadaCinema
Copy link
Author

Nevermind, I realised that the goroutine will actually terminate due to an error coming from ReadMessage().

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.

None yet

1 participant