1
0
Fork 0

ProcessXMLEntry struct was made into an anonymous struct.

This commit is contained in:
Alexander Andreev 2022-10-10 00:12:45 +04:00
parent 5f4555d769
commit f16e747205
Signed by: Arav
GPG Key ID: 0388CC8FAA51063F
1 changed files with 5 additions and 8 deletions

View File

@ -7,13 +7,6 @@ import (
// ProcessList is a map of processes' statuses.
type ProcessList map[string]bool
// ProcessXMLEntry is a XML representation of a process stored in ProcessList.
type ProcessXMLEntry struct {
XMLName xml.Name
Name string `xml:"name,attr"`
IsUp bool `xml:",chardata"`
}
// MarshalXML implements Marshaler interface for a ProcessList.
func (l *ProcessList) MarshalXML(e *xml.Encoder, start xml.StartElement) error {
if len(*l) == 0 {
@ -25,7 +18,11 @@ func (l *ProcessList) MarshalXML(e *xml.Encoder, start xml.StartElement) error {
}
for key, val := range *l {
e.Encode(ProcessXMLEntry{
e.Encode(struct {
XMLName xml.Name
Name string `xml:"name,attr"`
IsUp bool `xml:",chardata"`
}{
XMLName: xml.Name{Local: "Process"},
Name: key,
IsUp: val})