github.com/blend/go-sdk@v1.20220411.3/validate/first.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 // First is a validator that returns the first error of a given set of validators. 11 func First(validators ...Validator) Validator { 12 return func() error { 13 var err error 14 for _, validator := range validators { 15 if err = validator(); err != nil { 16 return err 17 } 18 } 19 return nil 20 } 21 }