mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-30 22:39:58 +02:00
Clean up lint in various packages
Changes fall into one of the following: - gofmt -s - receiver name is inconsistent - omit unused 2nd value from range - godoc comment formed incorrectly - err assigned and not used - if block ends with a return statement followed by else
This commit is contained in:
committed by
Bjørn Erik Pedersen
parent
d45e358a05
commit
47fdfd5196
@@ -503,25 +503,25 @@ func (i *intersector) appendIfNotSeen(v reflect.Value) {
|
||||
}
|
||||
}
|
||||
|
||||
func (ins *intersector) handleValuePair(l1vv, l2vv reflect.Value) {
|
||||
func (i *intersector) handleValuePair(l1vv, l2vv reflect.Value) {
|
||||
switch kind := l1vv.Kind(); {
|
||||
case kind == reflect.String:
|
||||
l2t, err := toString(l2vv)
|
||||
if err == nil && l1vv.String() == l2t {
|
||||
ins.appendIfNotSeen(l1vv)
|
||||
i.appendIfNotSeen(l1vv)
|
||||
}
|
||||
case isNumber(kind):
|
||||
f1, err1 := numberToFloat(l1vv)
|
||||
f2, err2 := numberToFloat(l2vv)
|
||||
if err1 == nil && err2 == nil && f1 == f2 {
|
||||
ins.appendIfNotSeen(l1vv)
|
||||
i.appendIfNotSeen(l1vv)
|
||||
}
|
||||
case kind == reflect.Ptr, kind == reflect.Struct:
|
||||
if l1vv.Interface() == l2vv.Interface() {
|
||||
ins.appendIfNotSeen(l1vv)
|
||||
i.appendIfNotSeen(l1vv)
|
||||
}
|
||||
case kind == reflect.Interface:
|
||||
ins.handleValuePair(reflect.ValueOf(l1vv.Interface()), l2vv)
|
||||
i.handleValuePair(reflect.ValueOf(l1vv.Interface()), l2vv)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ func (ns *Namespace) Printf(format string, a ...interface{}) string {
|
||||
|
||||
}
|
||||
|
||||
// Print returns string representation of the passed arguments ending with a newline.
|
||||
// Println returns string representation of the passed arguments ending with a newline.
|
||||
func (ns *Namespace) Println(a ...interface{}) string {
|
||||
return _fmt.Sprintln(a...)
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@ import (
|
||||
_ "image/jpeg"
|
||||
_ "image/png"
|
||||
|
||||
// Import webp codec
|
||||
_ "golang.org/x/image/webp"
|
||||
|
||||
"github.com/gohugoio/hugo/deps"
|
||||
|
||||
Reference in New Issue
Block a user