Code Room
Code reviewHard
Question
Review this Go function that records each event.
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 recordEvent(dsn string, e Event) error { db, err := sql.Open("postgres", dsn) // called on every event if err != nil { return err } defer db.Close() _, err = db.ExecContext(context.Background(), "INSERT INTO events(name, ts) VALUES($1, $2)", e.Name, e.Ts) return err}Run or narrate your approach, then ask the coach.