1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo.git synced 2024-11-21 08:31:27 -05:00

Update Validate()

This commit is contained in:
erik 2023-12-07 11:24:47 +01:00 committed by Michael Jerger
parent 39d4c8dd2d
commit 4d3ab4dda2

View file

@ -38,14 +38,14 @@ Validate collects error strings in a slice and returns this
*/
func (a ActorID) Validate() []string {
err := make([]string, 0, 3) // ToDo: Solve this dynamically
var err = []string{}
if res := a.validate_is_not_empty(a.schema, "schema"); res != nil {
err = append(err, res.Error())
if res := validate_is_not_empty(a.schema); res != nil {
err = append(err, strings.Join([]string{res.Error(), "for schema field"}, " "))
}
if res := a.validate_is_not_empty(a.host, "host"); res != nil {
err = append(err, res.Error())
if res := validate_is_not_empty(a.host); res != nil {
err = append(err, strings.Join([]string{res.Error(), "for host field"}, " "))
}
switch a.source {