Code RoomInterface{} boxing on hot path
HardPrep Room Coding #2108

Interface{} boxing on hot path

Code reviewCode quality & reviewSenior–Staff~22 min

Review this Go metrics aggregator on a hot path.

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.

0:00 of about 22 min
Mark a line and say what kind of problem it is.0 findings
1func record(metrics map[string]interface{}, name string, v float64) {
2 metrics[name] = v // float64 boxed into interface{}
3}
4 
5func total(metrics map[string]interface{}) float64 {
6 var sum float64
7 for _, raw := range metrics {
8 sum += raw.(float64) // type assertion per entry
9 }
10 return sum
11}
Which questions mattered is sealed until you submit. Telling you now would just be handing over the edge cases.