gitee.com/sy_183/go-common@v1.0.5-0.20231205030221-958cfe129b47/config/parser-group.go (about) 1 package config 2 3 import "gitee.com/sy_183/go-common/errors" 4 5 type parserGroup struct { 6 parsers []parser 7 errorIgnore func(err error) bool 8 } 9 10 func (p *parserGroup) Unmarshal(c interface{}) error { 11 var es error 12 for _, parser := range p.parsers { 13 err := parser.Unmarshal(c) 14 if err == nil { 15 return nil 16 } 17 errors.Append(es, err) 18 if p.errorIgnore(err) { 19 continue 20 } 21 return err 22 } 23 return es 24 }