github.com/blend/go-sdk@v1.20220411.3/selector/check_labels.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 selector 9 10 import "github.com/blend/go-sdk/ex" 11 12 // CheckLabels validates all the keys and values for the label set. 13 func CheckLabels(labels Labels) (err error) { 14 for key, value := range labels { 15 err = CheckKey(key) 16 if err != nil { 17 err = ex.New(err, ex.OptMessagef("key: %s", key)) 18 return 19 } 20 err = CheckValue(value) 21 if err != nil { 22 err = ex.New(err, ex.OptMessagef("key: %s, value: %s", key, value)) 23 return 24 } 25 } 26 return 27 }