Code Room
Code reviewMediumcr-g358
Subject Contract violationsLevel Mid–Senior~20 minCommon in Networking & APIs interviewsIndustries Software development, Technology

Question

Review this Go HTTP handler exposed at `GET /reports/:id/export`.

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.

Talk through your review
Code to reviewgo
func exportReport(w http.ResponseWriter, r *http.Request) {    id := chi.URLParam(r, "id")    report := repo.Get(id)    file := renderPDF(report)         // heavy, ~3s    repo.IncrementExportCount(id)     // writes to DB    audit.Log("export", id)           // side effect    w.Header().Set("Content-Type", "application/pdf")    w.Write(file)}
Run or narrate your approach, then ask the coach.