Code Room
Code reviewHardcr-g367
Subject Backward compatibilityLevel Senior–Staff~25 minCommon in Code quality & review interviewsIndustries Software development, Technology

Question

Review this Go change that adds a new field to a create-request struct for an existing v1 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.

Talk through your review
Code to reviewgo
type CreateInvoiceReq struct {    CustomerID string   `json:"customer_id"`    Amount     int64    `json:"amount"`    Currency   string   `json:"currency"`} func createInvoice(w http.ResponseWriter, r *http.Request) {    var req CreateInvoiceReq    json.NewDecoder(r.Body).Decode(&req)    if req.Currency == "" {        http.Error(w, "currency is required", 400) // newly added check    }    inv := invoices.Create(req.CustomerID, req.Amount, req.Currency)    writeJSON(w, 201, inv)}
Run or narrate your approach, then ask the coach.