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

Fixes to appease go static checker #1589

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Suhaibinator
Copy link
Contributor

Resolve some complaints from the static go checker

@@ -51,7 +51,6 @@ func registerInterfaceProvider(eh EventInterfaceProvider) {
// fmt.Errorf("event %s already registered", eh.Type())
}
registeredInterfaceProviders[eh.Type()] = eh
return
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Unnecessary return removed

@@ -52,6 +52,4 @@ func ExampleApplication() {
// Delete the application we created.
err = dg.ApplicationDelete(ap.ID)
log.Printf("Delete: err: %+v\n", err)

return
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Unnecessary return removed

@@ -1061,7 +1062,7 @@ func (s *State) OnInterface(se *Session, i interface{}) (err error) {
oldCopy := *old
t.BeforeUpdate = &oldCopy
}
err = s.ChannelAdd(t.Channel)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This error value is never used

@@ -1078,7 +1079,7 @@ func (s *State) OnInterface(se *Session, i interface{}) (err error) {
oldCopy := *old
t.BeforeUpdate = &oldCopy
}
err = s.ChannelAdd(t.Channel)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This error value is never used

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think it's better to fix the shadowing rather than its consequences.

@@ -501,8 +501,6 @@ func (v *VoiceConnection) onEvent(message []byte) {
default:
v.log(LogDebug, "unknown voice operation, %d, %s", e.Operation, string(e.RawData))
}

return
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Unnecessary return removed

@@ -787,7 +785,8 @@ func (v *VoiceConnection) opusSender(udpConn *net.UDPConn, close <-chan struct{}
sequence++
}

if (timestamp + uint32(size)) >= 0xFFFFFFFF {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The value given is greater than the max value of Uint32 which is impossible. Instead, we should check for integer ovrflow.

@Suhaibinator
Copy link
Contributor Author

@FedorLap2006 @bwmarrin

@Suhaibinator
Copy link
Contributor Author

@FedorLap2006 @bwmarrin bump

Copy link
Collaborator

@FedorLap2006 FedorLap2006 left a comment

Choose a reason for hiding this comment

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

LGTM

@Suhaibinator
Copy link
Contributor Author

@FedorLap2006 Can you merge please? I don't have merge perms

Copy link
Collaborator

@FedorLap2006 FedorLap2006 left a comment

Choose a reason for hiding this comment

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

After looking into it, I would change a couple of things, but other than that still LGTM.

@@ -1078,7 +1079,7 @@ func (s *State) OnInterface(se *Session, i interface{}) (err error) {
oldCopy := *old
t.BeforeUpdate = &oldCopy
}
err = s.ChannelAdd(t.Channel)
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think it's better to fix the shadowing rather than its consequences.

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.

2 participants