-
Notifications
You must be signed in to change notification settings - Fork 822
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,6 +52,4 @@ func ExampleApplication() { | |
// Delete the application we created. | ||
err = dg.ApplicationDelete(ap.ID) | ||
log.Printf("Delete: err: %+v\n", err) | ||
|
||
return | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unnecessary return removed |
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -175,8 +175,9 @@ func (s *State) GuildRemove(guild *Guild) error { | |
|
||
// Guild gets a guild by ID. | ||
// Useful for querying if @me is in a guild: | ||
// _, err := discordgo.Session.State.Guild(guildID) | ||
// isInGuild := err == nil | ||
// | ||
// _, err := discordgo.Session.State.Guild(guildID) | ||
// isInGuild := err == nil | ||
func (s *State) Guild(guildID string) (*Guild, error) { | ||
if s == nil { | ||
return nil, ErrNilState | ||
|
@@ -1061,7 +1062,7 @@ func (s *State) OnInterface(se *Session, i interface{}) (err error) { | |
oldCopy := *old | ||
t.BeforeUpdate = &oldCopy | ||
} | ||
err = s.ChannelAdd(t.Channel) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This error value is never used |
||
s.ChannelAdd(t.Channel) | ||
} | ||
case *ChannelDelete: | ||
if s.TrackChannels { | ||
|
@@ -1078,7 +1079,7 @@ func (s *State) OnInterface(se *Session, i interface{}) (err error) { | |
oldCopy := *old | ||
t.BeforeUpdate = &oldCopy | ||
} | ||
err = s.ChannelAdd(t.Channel) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This error value is never used There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. |
||
s.ChannelAdd(t.Channel) | ||
} | ||
case *ThreadDelete: | ||
if s.TrackThreads { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unnecessary return removed |
||
} | ||
|
||
type voiceHeartbeatOp struct { | ||
|
@@ -787,7 +785,8 @@ func (v *VoiceConnection) opusSender(udpConn *net.UDPConn, close <-chan struct{} | |
sequence++ | ||
} | ||
|
||
if (timestamp + uint32(size)) >= 0xFFFFFFFF { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. |
||
// Check for overflow and reset timestamp if needed | ||
if (timestamp + uint32(size)) < timestamp { | ||
timestamp = 0 | ||
} else { | ||
timestamp += uint32(size) | ||
|
@@ -920,7 +919,7 @@ func (v *VoiceConnection) reconnect() { | |
wait = 600 | ||
} | ||
|
||
if v.session.DataReady == false || v.session.wsConn == nil { | ||
if !v.session.DataReady || v.session.wsConn == nil { | ||
v.log(LogInformational, "cannot reconnect to channel %s with unready session", v.ChannelID) | ||
continue | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unnecessary return removed