Code Room
Code reviewMedium
Question
Review this Go function that truncates a 'bio' to fit a 16-byte database column, appending an ellipsis when it had to cut.
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
const maxBytes = 16 func truncateBio(bio string) string { if len(bio) <= maxBytes { return bio } truncated := bio[:maxBytes] return truncated + "\u2026"} func saveProfile(p *Profile) error { p.Bio = truncateBio(p.Bio) return db.Save(p)}Run or narrate your approach, then ask the coach.