Description
In compose/values_merge.go, the mergeValues function contains a wrong variable in the error message when checking stream reader types.
Code
ss := make([]streamReader, len(vs)-1)
for i := 0; i < len(ss); i++ {
sri, ok_ := vs[i+1].(streamReader)
if !ok_ {
return nil, fmt.Errorf("(mergeStream) unexpected type. "+
"expect: %v, got: %v", t0, reflect.TypeOf(vs[i])) // BUG: should be vs[i+1]
}
Bug
When the type assertion vs[i+1].(streamReader) fails, the error message shows reflect.TypeOf(vs[i]) (the previous element) instead of reflect.TypeOf(vs[i+1]) (the element that actually failed the assertion).
This causes the error message to report the wrong type, making debugging significantly harder because the user sees a type that successfully passed the assertion rather than the one that failed.
Fix
Change reflect.TypeOf(vs[i]) to reflect.TypeOf(vs[i+1]) on the error line.
return nil, fmt.Errorf("(mergeStream) unexpected type. "+
"expect: %v, got: %v", t0, reflect.TypeOf(vs[i+1])) // FIXED
Description
In
compose/values_merge.go, themergeValuesfunction contains a wrong variable in the error message when checking stream reader types.Code
Bug
When the type assertion
vs[i+1].(streamReader)fails, the error message showsreflect.TypeOf(vs[i])(the previous element) instead ofreflect.TypeOf(vs[i+1])(the element that actually failed the assertion).This causes the error message to report the wrong type, making debugging significantly harder because the user sees a type that successfully passed the assertion rather than the one that failed.
Fix
Change
reflect.TypeOf(vs[i])toreflect.TypeOf(vs[i+1])on the error line.