package auth import "fmt" const ( // Maximum number of bytes in a Username. MaxUsernameSize = 64 ) type Username string func ValidiateUsername(s string) (Username, error) { if len(s) > MaxUsernameSize { return "", fmt.Errorf("username longer than %d bytes: %q", MaxUsernameSize, s) } return Username(s), nil }