Code Room
Code reviewHard
Question
Review this Go file-download endpoint.
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 Download(w http.ResponseWriter, r *http.Request) { name := r.URL.Query().Get("file") path := filepath.Join("/srv/uploads", name) data, err := os.ReadFile(path) if err != nil { http.Error(w, "not found", 404) return } w.Header().Set("Content-Type", "application/octet-stream") w.Write(data)}Run or narrate your approach, then ask the coach.