mirror of
https://github.com/gohugoio/hugo.git
synced 2025-09-02 22:52:51 +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)
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user