Get rid of checks when creating constructs. Check should handle this.
This commit is contained in:
11
text.go
11
text.go
@@ -1,17 +1,14 @@
|
||||
package atom
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"html"
|
||||
)
|
||||
import "html"
|
||||
|
||||
type Text interface {
|
||||
isText() bool
|
||||
Check() error
|
||||
}
|
||||
|
||||
// NewText creates a new Text. It returns a Text and an error.
|
||||
func NewText(textType, content string) (Text, error) {
|
||||
// NewText creates a new Text. It returns a Text.
|
||||
func NewText(textType, content string) Text {
|
||||
switch textType {
|
||||
case "text", "":
|
||||
return newPlainText(textType, content)
|
||||
@@ -20,6 +17,6 @@ func NewText(textType, content string) (Text, error) {
|
||||
case "xhtml":
|
||||
return newXHTMLText(textType, content)
|
||||
default:
|
||||
return nil, fmt.Errorf("%v is not a valid text type", textType)
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user