package validate import "regexp" var ( UsernameRE = regexp.MustCompile(`^[a-z0-9_-]{3,32}$`) RepoNameRE = regexp.MustCompile(`^[a-z0-9._-]{1,100}$`) BranchRE = regexp.MustCompile(`^[A-Za-z0-9._/\-]{1,200}$`) ) func Username(s string) bool { return UsernameRE.MatchString(s) } func RepoName(s string) bool { return RepoNameRE.MatchString(s) } func Branch(s string) bool { return BranchRE.MatchString(s) } func ReservedName(s string) bool { switch s { case "api", "admin", "storage", "git", "repos", ".", "..": return true default: return false } }