Code Room
Code reviewHard
Question
Review this Go handler that serves user files.
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 serveTempFile(w http.ResponseWriter, name string) error { path := filepath.Join("/var/tmp/exports", name) info, err := os.Stat(path) if err != nil { return err } if info.Size() > maxExportBytes { return errTooLarge } data, err := os.ReadFile(path) // open + read after the stat if err != nil { return err } _, err = w.Write(data) return err}Run or narrate your approach, then ask the coach.