replace fmt.Sprintf(%s, i.Type()) with i.Type().String()

This commit is contained in:
Guoliang Wang 2018-05-30 18:18:58 +08:00
parent 15cd355281
commit 17ad3eaa26
2 changed files with 5 additions and 5 deletions

View File

@ -48,7 +48,7 @@ func (v *Error) ErrorBody() string {
var s string
switch v.Type {
case ErrorTypeRequired, ErrorTypeForbidden, ErrorTypeTooLong, ErrorTypeInternal:
s = fmt.Sprintf("%s", v.Type)
s = v.Type.String()
default:
value := v.BadValue
valueType := reflect.TypeOf(value)

View File

@ -80,7 +80,7 @@ func (l *ListNode) append(n Node) {
}
func (l *ListNode) String() string {
return fmt.Sprintf("%s", l.Type())
return l.Type().String()
}
// TextNode holds plain text.
@ -210,7 +210,7 @@ func newWildcard() *WildcardNode {
}
func (i *WildcardNode) String() string {
return fmt.Sprintf("%s", i.Type())
return i.Type().String()
}
// RecursiveNode means a recursive descent operator
@ -223,7 +223,7 @@ func newRecursive() *RecursiveNode {
}
func (r *RecursiveNode) String() string {
return fmt.Sprintf("%s", r.Type())
return r.Type().String()
}
// UnionNode is union of ListNode
@ -237,7 +237,7 @@ func newUnion(nodes []*ListNode) *UnionNode {
}
func (u *UnionNode) String() string {
return fmt.Sprintf("%s", u.Type())
return u.Type().String()
}
// BoolNode holds bool value