Make golangci-lint happy, second try

This commit is contained in:
s3lph 2020-09-27 01:59:31 +02:00
parent 2b17a3c193
commit 4825c1c2af

View File

@ -149,6 +149,7 @@ func (b *Bmumble) extractFiles(msg *config.Message) []config.Message {
} }
func (b *Bmumble) parseChannelPath(client *gumble.Client, name string) ([]string, error) { func (b *Bmumble) parseChannelPath(client *gumble.Client, name string) ([]string, error) {
// Parse the channel name as a numeric ID if passed as "ID:42"
if strings.HasPrefix(name, "ID:") { if strings.HasPrefix(name, "ID:") {
// Parse the ID string into an int // Parse the ID string into an int
channelID, err := strconv.ParseUint(name[3:], 10, 32) channelID, err := strconv.ParseUint(name[3:], 10, 32)
@ -163,7 +164,8 @@ func (b *Bmumble) parseChannelPath(client *gumble.Client, name string) ([]string
return nil, errors.New("no such channel: " + name) return nil, errors.New("no such channel: " + name)
} }
return gumbleutil.ChannelPath(c)[1:], nil return gumbleutil.ChannelPath(c)[1:], nil
} else { }
if !strings.HasPrefix(name, "/") { if !strings.HasPrefix(name, "/") {
return nil, errors.New("channel path must start with a '/': " + name) return nil, errors.New("channel path must start with a '/': " + name)
} }
@ -189,4 +191,3 @@ func (b *Bmumble) parseChannelPath(client *gumble.Client, name string) ([]string
} }
return gumbleutil.ChannelPath(c)[1:], nil return gumbleutil.ChannelPath(c)[1:], nil
} }
}