Code Room
Code reviewHard
Question
Review this Go function.
What a strong answer looks like
Separate real bugs from style. Rank issues by severity, point at the root cause rather than the symptom, and suggest a concrete fix — specific and kind.
Learn the concepts
func enrichOrders(ctx context.Context, db *sql.DB, orders []Order) ([]OrderView, error) { views := make([]OrderView, 0, len(orders)) for _, o := range orders { var name string err := db.QueryRowContext(ctx, "SELECT name FROM users WHERE id = $1", o.UserID).Scan(&name) if err != nil { return nil, err } views = append(views, OrderView{Order: o, UserName: name}) } return views, nil}Run or narrate your approach, then ask the coach.