Silence golint and go vet, mostly.
parent
1c19411c22
commit
f05a9e1e11
|
@ -17,7 +17,7 @@ import (
|
|||
"github.com/arachnist/gorepost/irc"
|
||||
)
|
||||
|
||||
var elementNotFound = errors.New("Element not found in document")
|
||||
var errElementNotFound = errors.New("element not found in document")
|
||||
|
||||
func httpGet(l string) ([]byte, error) {
|
||||
var buf []byte
|
||||
|
@ -71,9 +71,9 @@ func httpGetXpath(l, x string) (string, error) {
|
|||
|
||||
if len(sr) > 0 {
|
||||
return sr[0].InnerHtml(), nil
|
||||
} else {
|
||||
return "", elementNotFound
|
||||
}
|
||||
|
||||
return "", errElementNotFound
|
||||
}
|
||||
|
||||
func reply(msg irc.Message, text string) irc.Message {
|
||||
|
@ -83,11 +83,11 @@ func reply(msg irc.Message, text string) irc.Message {
|
|||
Params: []string{msg.Prefix.Name},
|
||||
Trailing: text,
|
||||
}
|
||||
} else {
|
||||
}
|
||||
|
||||
return irc.Message{
|
||||
Command: "PRIVMSG",
|
||||
Params: msg.Params,
|
||||
Trailing: text,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,10 +13,10 @@ import (
|
|||
"github.com/arachnist/gorepost/irc"
|
||||
)
|
||||
|
||||
var notAnError = errors.New("Not an error")
|
||||
var errNotReally = errors.New("not an error")
|
||||
|
||||
func redirectError(*http.Request, []*http.Request) error {
|
||||
return notAnError
|
||||
return errNotReally
|
||||
}
|
||||
|
||||
func kotki(output chan irc.Message, msg irc.Message) {
|
||||
|
|
|
@ -17,12 +17,12 @@ import (
|
|||
|
||||
var trimTitle *regexp.Regexp
|
||||
|
||||
func getUrlTitle(l string) string {
|
||||
func getURLTitle(l string) string {
|
||||
title, err := httpGetXpath(l, "//head/title")
|
||||
if err == elementNotFound {
|
||||
if err == errElementNotFound {
|
||||
return "no title"
|
||||
} else if err != nil {
|
||||
return fmt.Sprintf("error:", err)
|
||||
return fmt.Sprint("error:", err)
|
||||
}
|
||||
|
||||
return string(trimTitle.ReplaceAll([]byte(title), []byte{' '})[:])
|
||||
|
@ -42,9 +42,9 @@ func linktitle(output chan irc.Message, msg irc.Message) {
|
|||
}
|
||||
|
||||
if b {
|
||||
t := getUrlTitle(s)
|
||||
t := getURLTitle(s)
|
||||
if t != "no title" {
|
||||
r = append(r, getUrlTitle(s))
|
||||
r = append(r, t)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue