Added and corrected comments
This commit is contained in:
@@ -14,11 +14,12 @@ type Person struct {
|
||||
Extensions []*ExtensionElement `xml:",any,omitempty"`
|
||||
}
|
||||
|
||||
// NewPerson creates a new Person. It returns a *Person.
|
||||
func NewPerson(name string) *Person {
|
||||
return &Person{Name: name}
|
||||
}
|
||||
|
||||
// AddExtension adds the extension to the person
|
||||
// AddExtension adds the Extension to the Person.
|
||||
func (p *Person) AddExtension(e *ExtensionElement) {
|
||||
if p.Extensions == nil {
|
||||
p.Extensions = make([]*ExtensionElement, 1)
|
||||
@@ -28,6 +29,8 @@ func (p *Person) AddExtension(e *ExtensionElement) {
|
||||
}
|
||||
}
|
||||
|
||||
// Check checks the Person for incompatibilities with RFC4287. It returns an
|
||||
// error.
|
||||
func (p *Person) Check() error {
|
||||
if p.Name == "" {
|
||||
return errors.New("name element of person element empty")
|
||||
|
Reference in New Issue
Block a user