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

fix: a type switch nit #83

Merged
merged 1 commit into from
Apr 30, 2020
Merged

fix: a type switch nit #83

merged 1 commit into from
Apr 30, 2020

Conversation

Stebalien
Copy link
Member


@@ -188,7 +188,7 @@ func (as *AmbientAutoNAT) background() {
}

case e := <-subChan:
switch e.(type) {
switch e := e.(type) {
Copy link
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
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.

@@ -197,13 +197,14 @@ func (as *AmbientAutoNAT) background() {
}
}
case event.EvtPeerIdentificationCompleted:
peer = e.(event.EvtPeerIdentificationCompleted).Peer
Copy link
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