From 7c7ac065099f8b42303041a0d4e9d30e40d32081 Mon Sep 17 00:00:00 2001 From: Spotlight Date: Tue, 18 Aug 2020 14:38:28 -0500 Subject: [PATCH] Avoid redundant field struct usage --- structure.go | 2 -- utils.go | 5 ++--- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/structure.go b/structure.go index fefcb08..e4a2918 100644 --- a/structure.go +++ b/structure.go @@ -72,8 +72,6 @@ type Response struct { ErrorCode int ServiceStandbyMode bool `xml:"ServiceStandbyMode"` - // Allows a simple value node to be inserted. - KVFields []KVField // Allows for [dynamic content] situations. CustomFields []interface{} } diff --git a/utils.go b/utils.go index c2552bc..fb6e217 100644 --- a/utils.go +++ b/utils.go @@ -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 value. 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)