common: Fix elements are doubling when append a not assignable type

Fixes #6188
This commit is contained in:
Vazrupe (HyeonGyu Lee)
2019-10-09 18:36:25 +09:00
committed by Bjørn Erik Pedersen
parent 096a4b67b9
commit a9762b5c48
2 changed files with 3 additions and 0 deletions

View File

@@ -65,6 +65,7 @@ func Append(to interface{}, from ...interface{}) (interface{}, error) {
fv := reflect.ValueOf(f)
if !fv.Type().AssignableTo(tot) {
// Fall back to a []interface{} slice.
tov, _ := indirect(reflect.ValueOf(to))
return appendToInterfaceSlice(tov, from...)
}
tov = reflect.Append(tov, fv)