encoding/xml: fix panic in Marshal
Fixes #6341.
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/13512048
diff --git a/src/pkg/encoding/xml/marshal_test.go b/src/pkg/encoding/xml/marshal_test.go
index 8d9239e..6cd894e 100644
--- a/src/pkg/encoding/xml/marshal_test.go
+++ b/src/pkg/encoding/xml/marshal_test.go
@@ -904,6 +904,10 @@
X string `xml:"X>Y,attr"`
}
+type BadAttr struct {
+ Name []string `xml:"name,attr"`
+}
+
var marshalErrorTests = []struct {
Value interface{}
Err string
@@ -936,6 +940,10 @@
Value: &AttrParent{},
Err: `xml: X>Y chain not valid with attr flag`,
},
+ {
+ Value: BadAttr{[]string{"X", "Y"}},
+ Err: `xml: unsupported type: []string`,
+ },
}
var marshalIndentTests = []struct {