package main import "fmt" func validateUsername(username string) error { if !IsWhitespaceFree(username) { return fmt.Errorf(`username cannot contain spaces`) } if len(username) < 4 { return fmt.Errorf(`username too short`) } if len(username) > 1000 { return fmt.Errorf(`username too long`) } return nil } func validatePasswords(password, password2 string) error { if password != password2 { return fmt.Errorf(`the two password fields don't match`) } if len(password) == 0 { return fmt.Errorf(`password cannot be empty`) } return nil }