diff --git a/.golangci.yml b/.golangci.yml index 3df1cf9..77d054b 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -6,6 +6,8 @@ run: # timeout for analysis, e.g. 30s, 5m, default is 1m deadline: 1m + tests: false + # which dirs to skip: they won't be analyzed; # can use regexp here: generated.*, regexp is applied on full path; # default value is empty list, but next dirs are always skipped independently diff --git a/xml.go b/xml.go index 4995153..2c85ad8 100644 --- a/xml.go +++ b/xml.go @@ -307,21 +307,16 @@ func (t *Table) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { break } - switch token.(type) { + switch element := token.(type) { case xml.StartElement: - element := token.(xml.StartElement) - for _, attribute := range element.Attr { if attribute.Name.Local == "key" { currentKey = attribute.Value break } } - case xml.CharData: - element := token.(xml.CharData) currentValue = string(element) - case xml.EndElement: // Insert the current key/value pair. table[currentKey] = currentValue