Go code
if len(username) > 20 {
return errors.New("username too long")
}Line-by-line explanation
- Len counts bytes in this simple limit.
- The condition rejects excessive input.
- A returned error explains the failure.
Expected output
(no output)The function returns early when the limit is exceeded.
Validate input, set network timeouts, limit response sizes, keep secrets outside source code, use least privilege, review dependencies, check every error, and avoid building shell commands from user text.