mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-12-27 08:44:11 +01:00
Generalize validate_is_not_empty
This commit is contained in:
parent
085db0c127
commit
39d4c8dd2d
1 changed files with 2 additions and 5 deletions
|
@ -26,13 +26,10 @@ type ActorID struct {
|
||||||
port string // optional
|
port string // optional
|
||||||
}
|
}
|
||||||
|
|
||||||
// ToDo: validate_is_not_empty maybe not as an extra method
|
func validate_is_not_empty(str string) error {
|
||||||
func (a ActorID) validate_is_not_empty(str string, field string) error {
|
|
||||||
|
|
||||||
if str == "" {
|
if str == "" {
|
||||||
return fmt.Errorf("field %v was empty", field)
|
return fmt.Errorf("the given string was empty")
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue