Actually fixed the panic but reverted back to old working
All checks were successful
Build / build (push) Successful in 1m41s

This commit is contained in:
Leon Mika 2024-12-12 08:20:02 +11:00
parent 4a527cfe3d
commit a16afd0bc2

View file

@ -89,7 +89,8 @@ func (r *REPL) displayResult(ctx context.Context, w io.Writer, res any, concise
fmt.Fprintf(w, "]")
} else {
// In the off-chance that this is actually a slice of printables
vt := reflect.ValueOf(res).Type()
if len(v) > 0 {
vt := reflect.SliceOf(reflect.TypeOf(v[0]))
if tp, ok := r.typePrinters[vt]; ok {
canDisplay := true
@ -108,6 +109,7 @@ func (r *REPL) displayResult(ctx context.Context, w io.Writer, res any, concise
return tp(w, typeSlice.Interface(), concise)
}
}
}
for i := 0; i < len(v); i++ {
if err = r.displayResult(ctx, w, v[i], true); err != nil {