From f208691b12e43cd56da3e541707424274bb01050 Mon Sep 17 00:00:00 2001 From: Michael Marineau Date: Sat, 8 Aug 2015 17:01:00 -0700 Subject: [PATCH] omaha: stop wrapping URL slice in a struct Since splitting request and response structs it is no longer necessary to work around Go's awkard handling of a `xml:"urls>url"` tag. --- omaha/protocol.go | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/omaha/protocol.go b/omaha/protocol.go index caca6c0..3abe808 100644 --- a/omaha/protocol.go +++ b/omaha/protocol.go @@ -175,19 +175,14 @@ func (a *AppResponse) AddEvent() *EventResponse { } type UpdateResponse struct { - URLs *URLs `xml:"urls"` + URLs []*URL `xml:"urls>url" json:",omitempty"` Manifest *Manifest `xml:"manifest"` Status UpdateStatus `xml:"status,attr,omitempty"` } func (u *UpdateResponse) AddURL(codebase string) *URL { - // An intermediate struct is used instead of a "urls>url" tag simply - // to keep Go from generating if the list is empty. - if u.URLs == nil { - u.URLs = new(URLs) - } url := &URL{CodeBase: codebase} - u.URLs.URLs = append(u.URLs.URLs, url) + u.URLs = append(u.URLs, url) return url } @@ -219,10 +214,6 @@ type Event struct { Status string `xml:"status,attr,omitempty"` } -type URLs struct { - URLs []*URL `xml:"url" json:",omitempty"` -} - type URL struct { CodeBase string `xml:"codebase,attr"` }