Skip to content
This repository was archived by the owner on May 11, 2022. It is now read-only.

fix: a type switch nit#83

Merged
Stebalien merged 1 commit intomasterfrom
fix/switch-nit
Apr 30, 2020
Merged

fix: a type switch nit#83
Stebalien merged 1 commit intomasterfrom
fix/switch-nit

Conversation

@Stebalien
Copy link
Copy Markdown
Member


@Stebalien Stebalien requested a review from willscott April 30, 2020 03:20

case e := <-subChan:
switch e.(type) {
switch e := e.(type) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

is this free? I'd avoided doing it since the typed event wasn't needed in the localAddressesUpdated case.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

You are correct... by about a half a nanosecond. It saves a copy.

Up to you. I prefer this style because I like to avoid type panicing type assertions where possible.

}
}
case event.EvtPeerIdentificationCompleted:
peer = e.(event.EvtPeerIdentificationCompleted).Peer
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

remove the variable definition on line 174 since it's now unused, i think

@Stebalien Stebalien merged commit 31cf5b7 into master Apr 30, 2020
@Stebalien Stebalien deleted the fix/switch-nit branch April 30, 2020 05:31
@aschmahmann aschmahmann mentioned this pull request Sep 22, 2020
72 tasks
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants