Fix golangci-lint complaints, #2

This commit is contained in:
s3lph 2020-09-24 04:03:14 +02:00
parent 64ff9609af
commit dc6f2fb50c
2 changed files with 8 additions and 5 deletions

View File

@ -33,7 +33,9 @@ func (b *Bmumble) handleConnect(event *gumble.ConnectEvent) {
event.Client.Self.SetSelfMuted(true)
// if the Channel variable is set, this is a reconnect -> rejoin channel
if b.Channel != "" {
b.doJoin(event.Client, b.Channel)
if err := b.doJoin(event.Client, b.Channel); err != nil {
b.Log.Error(err)
}
b.Remote <- config.Message{
Username: "system",
Text: "rejoin",
@ -51,7 +53,9 @@ func (b *Bmumble) handleUserChange(event *gumble.UserChangeEvent) {
}
// Someone attempted to move the user out of the configured channel; attempt to join back
if b.Channel != "" && b.Channel != event.Client.Self.Channel.Name {
b.doJoin(event.Client, b.Channel)
if err := b.doJoin(event.Client, b.Channel); err != nil {
b.Log.Error(err)
}
}
}

View File

@ -71,14 +71,13 @@ func (b *Bmumble) Connect() error {
}
func (b *Bmumble) Disconnect() error {
b.client.Disconnect()
return nil
return b.client.Disconnect()
}
func (b *Bmumble) JoinChannel(channel config.ChannelInfo) error {
if b.Channel != "" && channel.Name != b.Channel {
b.Log.Fatalf("Cannot join channel '%s', already joined to channel '%s'", channel.Name, b.Channel)
return errors.New("The Mumble bridge can only join a single channel")
return errors.New("the Mumble bridge can only join a single channel")
}
b.Channel = channel.Name
return b.doJoin(b.client, channel.Name)