mirror of
https://github.com/1f349/go-webdav.git
synced 2024-12-22 08:14:15 +00:00
internal: don't double-wrap RawXMLValue
No need to go through another xml.Encoder.Encode roundtrip if the value is already a RawXMLValue.
This commit is contained in:
parent
8187cbf8c6
commit
6ae4814028
@ -28,6 +28,9 @@ func NewRawXMLElement(name xml.Name, attr []xml.Attr, children []RawXMLValue) *R
|
||||
// EncodeRawXMLElement encodes a value into a new RawXMLValue. The XML value
|
||||
// can only be used for marshalling.
|
||||
func EncodeRawXMLElement(v interface{}) (*RawXMLValue, error) {
|
||||
if raw, ok := v.(*RawXMLValue); ok {
|
||||
return raw, nil
|
||||
}
|
||||
return &RawXMLValue{out: v}, nil
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user