Compare commits
No commits in common. "d2a050bd8fdb42865286c364a34a35b40ef5c128" and "2a4adec6bdaee08dd8bdda0af6d5887b5d492f53" have entirely different histories.
d2a050bd8f
...
2a4adec6bd
@ -13,22 +13,16 @@ type Person struct {
|
||||
Extensions []*ExtensionElement `xml:",any,omitempty"`
|
||||
}
|
||||
|
||||
func NewPerson(name string) *Person {
|
||||
return &Person{Name: name}
|
||||
}
|
||||
|
||||
func (p *Person) Check() error {
|
||||
if p.Name == "" {
|
||||
return errors.New("name element of person element empty")
|
||||
}
|
||||
|
||||
if p.Extensions != nil {
|
||||
for i, e := range p.Extensions {
|
||||
if err := e.Check(); err != nil {
|
||||
return fmt.Errorf("extension element %v of person %v: %v", i, p.Name, err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user