Template
1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo synced 2024-11-22 09:54:24 +01:00

Generalize validate_is_not_empty

This commit is contained in:
erik 2023-12-07 11:24:27 +01:00 committed by Michael Jerger
parent 085db0c127
commit 39d4c8dd2d

View file

@ -26,13 +26,10 @@ type ActorID struct {
port string // optional
}
// ToDo: validate_is_not_empty maybe not as an extra method
func (a ActorID) validate_is_not_empty(str string, field string) error {
func validate_is_not_empty(str string) error {
if str == "" {
return fmt.Errorf("field %v was empty", field)
return fmt.Errorf("the given string was empty")
}
return nil
}