User Input
Assignment
package status
import "errors"
// validateStatus returns an error if the provided status is invalid.
// - empty status -> error "status cannot be empty"
// - status longer than 140 chars -> error "status exceeds 140 characters"
func validateStatus(s string) error {
if len(s) == 0 {
return errors.New("status cannot be empty")
}
if len(s) > 140 {
return errors.New("status exceeds 140 characters")
}
return nil
}