Simplify error creation.
This commit is contained in:
parent
7a91f5d8ea
commit
b13d0baad0
|
|
@ -4,7 +4,6 @@ import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"crypto/tls"
|
"crypto/tls"
|
||||||
"encoding/xml"
|
"encoding/xml"
|
||||||
"errors"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
"net"
|
"net"
|
||||||
|
|
@ -106,7 +105,7 @@ func (stream *Stream) Next(match *xml.Name) (*xml.StartElement, error) {
|
||||||
}
|
}
|
||||||
if e, ok := t.(xml.StartElement); ok {
|
if e, ok := t.(xml.StartElement); ok {
|
||||||
if match != nil && e.Name != *match {
|
if match != nil && e.Name != *match {
|
||||||
return nil, errors.New(fmt.Sprintf("Expected %s, got %s", *match, e.Name))
|
return nil, fmt.Errorf("Expected %s, got %s", *match, e.Name)
|
||||||
}
|
}
|
||||||
return &e, nil
|
return &e, nil
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue