summaryrefslogtreecommitdiffstats
path: root/modules/validation/binding.go
diff options
context:
space:
mode:
Diffstat (limited to 'modules/validation/binding.go')
-rw-r--r--modules/validation/binding.go16
1 files changed, 8 insertions, 8 deletions
diff --git a/modules/validation/binding.go b/modules/validation/binding.go
index 1f904979ff..cb0a5063e5 100644
--- a/modules/validation/binding.go
+++ b/modules/validation/binding.go
@@ -46,7 +46,7 @@ func addGitRefNameBindingRule() {
IsMatch: func(rule string) bool {
return strings.HasPrefix(rule, "GitRefName")
},
- IsValid: func(errs binding.Errors, name string, val interface{}) (bool, binding.Errors) {
+ IsValid: func(errs binding.Errors, name string, val any) (bool, binding.Errors) {
str := fmt.Sprintf("%v", val)
if !git.IsValidRefPattern(str) {
@@ -64,7 +64,7 @@ func addValidURLBindingRule() {
IsMatch: func(rule string) bool {
return strings.HasPrefix(rule, "ValidUrl")
},
- IsValid: func(errs binding.Errors, name string, val interface{}) (bool, binding.Errors) {
+ IsValid: func(errs binding.Errors, name string, val any) (bool, binding.Errors) {
str := fmt.Sprintf("%v", val)
if len(str) != 0 && !IsValidURL(str) {
errs.Add([]string{name}, binding.ERR_URL, "Url")
@@ -82,7 +82,7 @@ func addValidSiteURLBindingRule() {
IsMatch: func(rule string) bool {
return strings.HasPrefix(rule, "ValidSiteUrl")
},
- IsValid: func(errs binding.Errors, name string, val interface{}) (bool, binding.Errors) {
+ IsValid: func(errs binding.Errors, name string, val any) (bool, binding.Errors) {
str := fmt.Sprintf("%v", val)
if len(str) != 0 && !IsValidSiteURL(str) {
errs.Add([]string{name}, binding.ERR_URL, "Url")
@@ -103,7 +103,7 @@ func addGlobPatternRule() {
})
}
-func globPatternValidator(errs binding.Errors, name string, val interface{}) (bool, binding.Errors) {
+func globPatternValidator(errs binding.Errors, name string, val any) (bool, binding.Errors) {
str := fmt.Sprintf("%v", val)
if len(str) != 0 {
@@ -125,7 +125,7 @@ func addRegexPatternRule() {
})
}
-func regexPatternValidator(errs binding.Errors, name string, val interface{}) (bool, binding.Errors) {
+func regexPatternValidator(errs binding.Errors, name string, val any) (bool, binding.Errors) {
str := fmt.Sprintf("%v", val)
if _, err := regexp.Compile(str); err != nil {
@@ -141,7 +141,7 @@ func addGlobOrRegexPatternRule() {
IsMatch: func(rule string) bool {
return rule == "GlobOrRegexPattern"
},
- IsValid: func(errs binding.Errors, name string, val interface{}) (bool, binding.Errors) {
+ IsValid: func(errs binding.Errors, name string, val any) (bool, binding.Errors) {
str := strings.TrimSpace(fmt.Sprintf("%v", val))
if len(str) >= 2 && strings.HasPrefix(str, "/") && strings.HasSuffix(str, "/") {
@@ -157,7 +157,7 @@ func addUsernamePatternRule() {
IsMatch: func(rule string) bool {
return rule == "Username"
},
- IsValid: func(errs binding.Errors, name string, val interface{}) (bool, binding.Errors) {
+ IsValid: func(errs binding.Errors, name string, val any) (bool, binding.Errors) {
str := fmt.Sprintf("%v", val)
if !IsValidUsername(str) {
errs.Add([]string{name}, ErrUsername, "invalid username")
@@ -173,7 +173,7 @@ func addValidGroupTeamMapRule() {
IsMatch: func(rule string) bool {
return strings.HasPrefix(rule, "ValidGroupTeamMap")
},
- IsValid: func(errs binding.Errors, name string, val interface{}) (bool, binding.Errors) {
+ IsValid: func(errs binding.Errors, name string, val any) (bool, binding.Errors) {
_, err := auth.UnmarshalGroupTeamMapping(fmt.Sprintf("%v", val))
if err != nil {
errs.Add([]string{name}, ErrInvalidGroupTeamMap, err.Error())