Get rid of checks when creating constructs. Check should handle this.
This commit is contained in:
20
generator.go
20
generator.go
@@ -2,7 +2,6 @@ package atom
|
||||
|
||||
import (
|
||||
"encoding/xml"
|
||||
"errors"
|
||||
"fmt"
|
||||
"html"
|
||||
)
|
||||
@@ -15,22 +14,9 @@ type Generator struct {
|
||||
Text string `xml:",chardata"`
|
||||
}
|
||||
|
||||
// NewGenerator creates a new Generator. It returns a *Generator and an error.
|
||||
func NewGenerator(text string) (*Generator, error) {
|
||||
if text == "" {
|
||||
return nil, errors.New("error creating new generator: text string empty")
|
||||
}
|
||||
|
||||
return &Generator{Text: html.UnescapeString(text)}, nil
|
||||
}
|
||||
|
||||
// SetURI sets the URI attribute of the Generator. It returns an error.
|
||||
func (g *Generator) SetURI(uri string) error {
|
||||
if !isValidIRI(uri) {
|
||||
return fmt.Errorf("uri %v not correctly formatted", g)
|
||||
}
|
||||
|
||||
return nil
|
||||
// NewGenerator creates a new Generator. It returns a *Generator.
|
||||
func NewGenerator(text string) *Generator {
|
||||
return &Generator{Text: html.UnescapeString(text)}
|
||||
}
|
||||
|
||||
// Check checks the Generator for incompatibilities with RFC4287. It returns an
|
||||
|
Reference in New Issue
Block a user