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.
This commit is contained in:
parent
a3bc668225
commit
f208691b12
1 changed files with 2 additions and 11 deletions
|
@ -175,19 +175,14 @@ func (a *AppResponse) AddEvent() *EventResponse {
|
||||||
}
|
}
|
||||||
|
|
||||||
type UpdateResponse struct {
|
type UpdateResponse struct {
|
||||||
URLs *URLs `xml:"urls"`
|
URLs []*URL `xml:"urls>url" json:",omitempty"`
|
||||||
Manifest *Manifest `xml:"manifest"`
|
Manifest *Manifest `xml:"manifest"`
|
||||||
Status UpdateStatus `xml:"status,attr,omitempty"`
|
Status UpdateStatus `xml:"status,attr,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (u *UpdateResponse) AddURL(codebase string) *URL {
|
func (u *UpdateResponse) AddURL(codebase string) *URL {
|
||||||
// An intermediate struct is used instead of a "urls>url" tag simply
|
|
||||||
// to keep Go from generating <urls></urls> if the list is empty.
|
|
||||||
if u.URLs == nil {
|
|
||||||
u.URLs = new(URLs)
|
|
||||||
}
|
|
||||||
url := &URL{CodeBase: codebase}
|
url := &URL{CodeBase: codebase}
|
||||||
u.URLs.URLs = append(u.URLs.URLs, url)
|
u.URLs = append(u.URLs, url)
|
||||||
return url
|
return url
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -219,10 +214,6 @@ type Event struct {
|
||||||
Status string `xml:"status,attr,omitempty"`
|
Status string `xml:"status,attr,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type URLs struct {
|
|
||||||
URLs []*URL `xml:"url" json:",omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type URL struct {
|
type URL struct {
|
||||||
CodeBase string `xml:"codebase,attr"`
|
CodeBase string `xml:"codebase,attr"`
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue