Avoid redundant field struct usage

This commit is contained in:
Spotlight 2020-08-18 14:38:28 -05:00
parent f32e2a5f2e
commit 7c7ac06509
No known key found for this signature in database
GPG Key ID: 874AA355B3209BDC
2 changed files with 2 additions and 5 deletions

View File

@ -72,8 +72,6 @@ type Response struct {
ErrorCode int
ServiceStandbyMode bool `xml:"ServiceStandbyMode"`
// Allows a simple <name>value</name> node to be inserted.
KVFields []KVField
// Allows for <name>[dynamic content]</name> situations.
CustomFields []interface{}
}

View File

@ -96,9 +96,9 @@ func (e *Envelope) ObtainCommon(doc *xmlquery.Node) error {
return nil
}
// AddKVNode adds a given key by name to a specified value.
// AddKVNode adds a given key by name to a specified value, such as <key>value</key>.
func (e *Envelope) AddKVNode(key string, value string) {
e.Body.Response.KVFields = append(e.Body.Response.KVFields, KVField{
e.Body.Response.CustomFields = append(e.Body.Response.CustomFields, KVField{
XMLName: xml.Name{Local: key},
Value: value,
})
@ -135,7 +135,6 @@ func (e *Envelope) ReturnError(errorCode int, reason string, err error) (bool, s
e.Body.Response.ErrorCode = errorCode
// Ensure all additional fields are empty to avoid conflict.
e.Body.Response.KVFields = []KVField{}
e.Body.Response.CustomFields = nil
e.AddKVNode("UserReason", reason)