Code Room
Code reviewMediumcr-g333
Subject EncodingLevel Mid–Senior~18 minCommon in Code quality & review interviewsIndustries Software development

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.

Talk through your review
Code to reviewgo
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.