github.com/blend/go-sdk@v1.20220411.3/validate/return_all.go (about) 1 /* 2 3 Copyright (c) 2022 - Present. Blend Labs, Inc. All rights reserved 4 Use of this source code is governed by a MIT license that can be found in the LICENSE file. 5 6 */ 7 8 package validate 9 10 // ReturnAll returns all the failing validations as an 11 // array of validation errors. 12 func ReturnAll(validators ...Validator) error { 13 var output []error 14 var err error 15 for _, validator := range validators { 16 if err = validator(); err != nil { 17 output = append(output, err) 18 } 19 } 20 if len(output) > 0 { 21 return ValidationErrors(output) 22 } 23 return nil 24 }