From 032fe9d27c59c1f1cae04c3b3d18d39b4d9c5126 Mon Sep 17 00:00:00 2001 From: jim teeuwen Date: Wed, 29 Feb 2012 11:42:39 +0100 Subject: [PATCH] Run gofmt and fix the Unmarshal test. --- document.go | 22 +++++++++++----------- xmlx_test.go | 14 +++++++------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/document.go b/document.go index 9d722f5..2d454ff 100644 --- a/document.go +++ b/document.go @@ -43,22 +43,22 @@ type CharsetFunc func(charset string, input io.Reader) (io.Reader, error) // represents a single XML document. type Document struct { - Version string // XML version - Encoding string // Encoding found in document. If absent, assumes UTF-8. - StandAlone string // Value of XML doctype's 'standalone' attribute. - Entity map[string]string // Mapping of custom entity conversions. - Root *Node // The document's root node. - SaveDocType bool // Whether not to include the XML doctype in saves. + Version string // XML version + Encoding string // Encoding found in document. If absent, assumes UTF-8. + StandAlone string // Value of XML doctype's 'standalone' attribute. + Entity map[string]string // Mapping of custom entity conversions. + Root *Node // The document's root node. + SaveDocType bool // Whether not to include the XML doctype in saves. } // Create a new, empty XML document instance. func New() *Document { return &Document{ - Version: "1.0", - Encoding: "utf-8", - StandAlone: "yes", - SaveDocType: true, - Entity: make(map[string]string), + Version: "1.0", + Encoding: "utf-8", + StandAlone: "yes", + SaveDocType: true, + Entity: make(map[string]string), } } diff --git a/xmlx_test.go b/xmlx_test.go index 0999c5d..ef507bf 100644 --- a/xmlx_test.go +++ b/xmlx_test.go @@ -85,12 +85,12 @@ func TestNodeSearch(t *testing.T) { } type Image struct { - Title string - Url string - Link string - Width string - Height string - Description string + Title string `xml:"title"` + Url string `xml:"url"` + Link string `xml:"link"` + Description string `xml:"description"` + Width int `xml:"width"` + Height int `xml:"height"` } func TestUnmarshal(t *testing.T) { @@ -108,7 +108,7 @@ func TestUnmarshal(t *testing.T) { return } - img := Image{} + var img Image if err = node.Unmarshal(&img); err != nil { t.Errorf("Unmarshal(): %s", err) return