diff --git a/Godeps/Godeps.json b/Godeps/Godeps.json index 5111dcde3..766cf5978 100644 --- a/Godeps/Godeps.json +++ b/Godeps/Godeps.json @@ -1,6 +1,6 @@ { "ImportPath": "github.com/minio-io/minio", - "GoVersion": "go1.4", + "GoVersion": "go1.4.2", "Packages": [ "./..." ], diff --git a/Godeps/_workspace/src/github.com/clbanning/mxj/anyxml.go b/Godeps/_workspace/src/github.com/clbanning/mxj/anyxml.go index 4eb6001d1..5579e1036 100644 --- a/Godeps/_workspace/src/github.com/clbanning/mxj/anyxml.go +++ b/Godeps/_workspace/src/github.com/clbanning/mxj/anyxml.go @@ -9,21 +9,21 @@ const ( DefaultElementTag = "element" ) -// Encode arbitrary value as XML. -// +// Encode arbitrary value as XML. +// // Note: unmarshaling the resultant // XML may not return the original value, since tag labels may have been injected // to create the XML representation of the value. /* Encode an arbitrary JSON object. package main - + import ( "encoding/json" "fmt" "github/clbanning/mxj" ) - + func main() { jsondata := []byte(`[ { "somekey":"somevalue" }, @@ -42,7 +42,7 @@ const ( } fmt.Println(string(x)) } - + output: somevalue @@ -110,7 +110,6 @@ func AnyXml(v interface{}, tags ...string) ([]byte, error) { return b, err } - // Encode an arbitrary value as a pretty XML string. // Alternative values for DefaultRootTag and DefaultElementTag can be set as: // AnyXmlIndent( v, "", " ", myRootTag, myElementTag). diff --git a/Godeps/_workspace/src/github.com/clbanning/mxj/anyxml_test.go b/Godeps/_workspace/src/github.com/clbanning/mxj/anyxml_test.go index f4c80a513..df7228286 100644 --- a/Godeps/_workspace/src/github.com/clbanning/mxj/anyxml_test.go +++ b/Godeps/_workspace/src/github.com/clbanning/mxj/anyxml_test.go @@ -43,7 +43,7 @@ func TestAnyXml(t *testing.T) { } fmt.Println("[]->x:", string(x)) - a := []interface{}{ "try", "this", 3.14159265, true } + a := []interface{}{"try", "this", 3.14159265, true} x, err = AnyXml(a) if err != nil { t.Fatal(err) @@ -82,7 +82,7 @@ func TestAnyXmlIndent(t *testing.T) { } fmt.Println("[]->x:\n", string(x)) - a := []interface{}{ "try", "this", 3.14159265, true } + a := []interface{}{"try", "this", 3.14159265, true} x, err = AnyXmlIndent(a, "", " ") if err != nil { t.Fatal(err) diff --git a/Godeps/_workspace/src/github.com/clbanning/mxj/data_test.go b/Godeps/_workspace/src/github.com/clbanning/mxj/data_test.go index b3a4aaec9..357513f66 100644 --- a/Godeps/_workspace/src/github.com/clbanning/mxj/data_test.go +++ b/Godeps/_workspace/src/github.com/clbanning/mxj/data_test.go @@ -36,4 +36,3 @@ var jsondata = []byte(` {"book":{"author":"John Hawkes","review":"A lyrical novel about the construction of Ft. Peck Dam in Montana.","title":"The Beetle Leg"}} {"book":{"author":{"first_name":"T.E.","last_name":"Porter"},"review":"A magical novella.","title":"King's Day"}} { "here":"we", "put":"in", "an":error }`) - diff --git a/Godeps/_workspace/src/github.com/clbanning/mxj/doc.go b/Godeps/_workspace/src/github.com/clbanning/mxj/doc.go index cb9813106..4db312c6e 100644 --- a/Godeps/_workspace/src/github.com/clbanning/mxj/doc.go +++ b/Godeps/_workspace/src/github.com/clbanning/mxj/doc.go @@ -31,7 +31,7 @@ SUMMARY Marshal Map value, 'm', to an XML Writer (io.Writer): err := m.XmlWriter(xmlWriter) raw, err := m.XmlWriterRaw(xmlWriter) // 'raw' is the raw XML that was written on xmlWriter - + Also, for prettified output: xmlValue, err := m.XmlIndent(prefix, indent, ...) err := m.XmlIndentWriter(xmlWriter, prefix, indent, ...) @@ -72,7 +72,7 @@ XML PARSING CONVENTIONS - Attributes are parsed to map[string]interface{} values by prefixing a hyphen, '-', to the attribute label. (PrependAttrWithHyphen(false) will override this.) - If the element is a simple element and has attributes, the element value - is given the key '#text' for its map[string]interface{} representation. + is given the key '#text' for its map[string]interface{} representation. XML ENCODING CONVENTIONS diff --git a/Godeps/_workspace/src/github.com/clbanning/mxj/example_test.go b/Godeps/_workspace/src/github.com/clbanning/mxj/example_test.go index 5bcb0ab08..81fb28612 100644 --- a/Godeps/_workspace/src/github.com/clbanning/mxj/example_test.go +++ b/Godeps/_workspace/src/github.com/clbanning/mxj/example_test.go @@ -8,8 +8,8 @@ package mxj_test import ( "bytes" "fmt" - "io" "github.com/clbanning/mxj" + "io" ) func ExampleHandleXmlReader() { @@ -246,59 +246,59 @@ func ExampleMap_ValuesForKeyPath() { } func ExampleMap_UpdateValuesForPath() { -/* - -var biblioDoc = []byte(` - - - William Gaddis - - - The Recognitions - 1955 - A novel that changed the face of American literature. - - - JR - 1975 - Winner of National Book Award for Fiction. - - - -`) + /* - ... - m, merr := mxj.NewMapXml(biblioDoc) - if merr != nil { - // handle error - } + var biblioDoc = []byte(` + + + William Gaddis + + + The Recognitions + 1955 + A novel that changed the face of American literature. + + + JR + 1975 + Winner of National Book Award for Fiction. + + + + `) - // change 'review' for a book - count, err := m.UpdateValuesForPath("review:National Book Award winner." "*.*.*.*", "title:JR") - if err != nil { - // handle error - } - ... + ... + m, merr := mxj.NewMapXml(biblioDoc) + if merr != nil { + // handle error + } - // change 'date' value from string type to float64 type - // Note: the following is equivalent to m, merr := NewMapXml(biblioDoc, mxj.Cast). - path := m.PathForKeyShortest("date") - v, err := m.ValuesForPath(path) - if err != nil { - // handle error - } - var total int - for _, vv := range v { - oldVal := "date:" + vv.(string) - newVal := "date:" + vv.(string) + ":num" - n, err := m.UpdateValuesForPath(newVal, path, oldVal) - if err != nil { - // handle error - } - total += n - } - ... -*/ + // change 'review' for a book + count, err := m.UpdateValuesForPath("review:National Book Award winner." "*.*.*.*", "title:JR") + if err != nil { + // handle error + } + ... + + // change 'date' value from string type to float64 type + // Note: the following is equivalent to m, merr := NewMapXml(biblioDoc, mxj.Cast). + path := m.PathForKeyShortest("date") + v, err := m.ValuesForPath(path) + if err != nil { + // handle error + } + var total int + for _, vv := range v { + oldVal := "date:" + vv.(string) + newVal := "date:" + vv.(string) + ":num" + n, err := m.UpdateValuesForPath(newVal, path, oldVal) + if err != nil { + // handle error + } + total += n + } + ... + */ } func ExampleMap_Copy() { @@ -313,34 +313,32 @@ func ExampleMap_Copy() { private string } s := str{IntVal: 4, StrVal: "now's the time", FloatVal: 3.14159, BoolVal: true, private: "Skies are blue"} - m := make(map[string]interface{},0) + m := make(map[string]interface{}, 0) m["struct"] = interface{}(s) m["struct_ptr"] = interface{}(&s) m["misc"] = interface{}(`Now is the time`) - mv := mxj.Map(m) - cp,_ := mv.Copy() + cp, _ := mv.Copy() fmt.Printf("mv:%s\n", mv.StringIndent(2)) fmt.Printf("cp:%s\n", cp.StringIndent(2)) -// Output: -// mv: -// struct :[unknown] mxj_test.str{IntVal:4, StrVal:"now's the time", FloatVal:3.14159, BoolVal:true, private:"Skies are blue"} -// struct_ptr :[unknown] &mxj_test.str{IntVal:4, StrVal:"now's the time", FloatVal:3.14159, BoolVal:true, private:"Skies are blue"} -// misc :[string] Now is the time -// cp: -// misc :[string] Now is the time -// struct : -// int :[float64] 4.00e+00 -// str :[string] now's the time -// float :[float64] 3.14e+00 -// bool :[bool] true -// struct_ptr : -// int :[float64] 4.00e+00 -// str :[string] now's the time -// float :[float64] 3.14e+00 -// bool :[bool] true + // Output: + // mv: + // struct :[unknown] mxj_test.str{IntVal:4, StrVal:"now's the time", FloatVal:3.14159, BoolVal:true, private:"Skies are blue"} + // struct_ptr :[unknown] &mxj_test.str{IntVal:4, StrVal:"now's the time", FloatVal:3.14159, BoolVal:true, private:"Skies are blue"} + // misc :[string] Now is the time + // cp: + // misc :[string] Now is the time + // struct : + // int :[float64] 4.00e+00 + // str :[string] now's the time + // float :[float64] 3.14e+00 + // bool :[bool] true + // struct_ptr : + // int :[float64] 4.00e+00 + // str :[string] now's the time + // float :[float64] 3.14e+00 + // bool :[bool] true } - diff --git a/Godeps/_workspace/src/github.com/clbanning/mxj/examples/books.go b/Godeps/_workspace/src/github.com/clbanning/mxj/examples/books.go index 8c43d05fa..e703d8395 100644 --- a/Godeps/_workspace/src/github.com/clbanning/mxj/examples/books.go +++ b/Godeps/_workspace/src/github.com/clbanning/mxj/examples/books.go @@ -4,8 +4,8 @@ package main import ( "fmt" - "log" "github.com/clbanning/mxj" + "log" ) var xmldata = []byte(` diff --git a/Godeps/_workspace/src/github.com/clbanning/mxj/examples/getmetrics1.go b/Godeps/_workspace/src/github.com/clbanning/mxj/examples/getmetrics1.go index 91c624613..c4e680382 100644 --- a/Godeps/_workspace/src/github.com/clbanning/mxj/examples/getmetrics1.go +++ b/Godeps/_workspace/src/github.com/clbanning/mxj/examples/getmetrics1.go @@ -1,5 +1,5 @@ // getmetrics1.go - transform Eclipse Metrics (v3) XML report into CSV files for each metric -// Uses NewMapXmlReader on os.File without copying the raw XML into a buffer while decoding.. +// Uses NewMapXmlReader on os.File without copying the raw XML into a buffer while decoding.. // Shows no significant overhead for not first buffering large XML file as in getmetrics2.go. /* @@ -38,10 +38,10 @@ package main import ( "flag" "fmt" + "github.com/clbanning/mxj" "log" "os" "time" - "github.com/clbanning/mxj" ) func main() { diff --git a/Godeps/_workspace/src/github.com/clbanning/mxj/examples/getmetrics2.go b/Godeps/_workspace/src/github.com/clbanning/mxj/examples/getmetrics2.go index a11cbd756..65d6c9513 100644 --- a/Godeps/_workspace/src/github.com/clbanning/mxj/examples/getmetrics2.go +++ b/Godeps/_workspace/src/github.com/clbanning/mxj/examples/getmetrics2.go @@ -39,10 +39,10 @@ package main import ( "flag" "fmt" + "github.com/clbanning/mxj" "log" "os" "time" - "github.com/clbanning/mxj" ) func main() { @@ -81,7 +81,7 @@ func main() { fmt.Println(time.Now().String(), "... XML Unmarshaled - len:", len(m)) // Get just the key values of interest. - // Could also use m.ValuesForKey("Metric"), + // Could also use m.ValuesForKey("Metric"), // since there's just the one path. metricVals, err := m.ValuesForPath("Metrics.Metric") if err != nil { diff --git a/Godeps/_workspace/src/github.com/clbanning/mxj/examples/getmetrics3.go b/Godeps/_workspace/src/github.com/clbanning/mxj/examples/getmetrics3.go index 370702fbd..a914d5491 100644 --- a/Godeps/_workspace/src/github.com/clbanning/mxj/examples/getmetrics3.go +++ b/Godeps/_workspace/src/github.com/clbanning/mxj/examples/getmetrics3.go @@ -40,10 +40,10 @@ package main import ( "flag" "fmt" + "github.com/clbanning/mxj" "log" "os" "time" - "github.com/clbanning/mxj" ) func main() { diff --git a/Godeps/_workspace/src/github.com/clbanning/mxj/examples/getmetrics4.go b/Godeps/_workspace/src/github.com/clbanning/mxj/examples/getmetrics4.go index a8db0b7bf..2cf663817 100644 --- a/Godeps/_workspace/src/github.com/clbanning/mxj/examples/getmetrics4.go +++ b/Godeps/_workspace/src/github.com/clbanning/mxj/examples/getmetrics4.go @@ -1,7 +1,7 @@ // getmetrics2.go - transform Eclipse Metrics (v3) XML report into CSV files for each metric // Uses an in-memory buffer for the XML data and direct XML decoding of the buffer into a Map. // Then XML buffer is decoded into a Map while the raw XML is copied using NewMapXmlReaderRaw() -// to illustrate processing overhead relative to getmetrics2.go. Not a practical example, +// to illustrate processing overhead relative to getmetrics2.go. Not a practical example, // but confirms the getmetrics1.go vs. getmetrics3.go use case. /* @@ -41,10 +41,10 @@ import ( "bytes" "flag" "fmt" + "github.com/clbanning/mxj" "log" "os" "time" - "github.com/clbanning/mxj" ) func main() { @@ -79,7 +79,7 @@ func main() { // load XML into a Map value // Note: there is a single record with root tag of "Metrics". - m, raw, merr := mxj.NewMapXmlReaderRaw(xmlReader) // don't catch the pointer to raw XML + m, raw, merr := mxj.NewMapXmlReaderRaw(xmlReader) // don't catch the pointer to raw XML if merr != nil { log.Fatal("merr:", merr.Error()) } @@ -87,7 +87,7 @@ func main() { fmt.Println("raw XML buffer size (should be same as File size):", len(*raw)) // Get just the key values of interest. - // Could also use m.ValuesForKey("Metric"), + // Could also use m.ValuesForKey("Metric"), // since there's just the one path. metricVals, err := m.ValuesForPath("Metrics.Metric") if err != nil { diff --git a/Godeps/_workspace/src/github.com/clbanning/mxj/examples/gonuts1.go b/Godeps/_workspace/src/github.com/clbanning/mxj/examples/gonuts1.go index 0564fbc80..a0c5d6fce 100644 --- a/Godeps/_workspace/src/github.com/clbanning/mxj/examples/gonuts1.go +++ b/Godeps/_workspace/src/github.com/clbanning/mxj/examples/gonuts1.go @@ -6,8 +6,8 @@ package main import ( "bytes" "fmt" - "io" "github.com/clbanning/mxj" + "io" ) // Demo how to compensate for irregular tag labels in data. diff --git a/Godeps/_workspace/src/github.com/clbanning/mxj/examples/gonuts2.go b/Godeps/_workspace/src/github.com/clbanning/mxj/examples/gonuts2.go index 8cacafeeb..6bd0bab73 100644 --- a/Godeps/_workspace/src/github.com/clbanning/mxj/examples/gonuts2.go +++ b/Godeps/_workspace/src/github.com/clbanning/mxj/examples/gonuts2.go @@ -108,9 +108,9 @@ func fullPath(xmldata [][]byte) { } func partPath1(msg []byte) { - fmt.Println("\nmsg:",string(msg)) + fmt.Println("\nmsg:", string(msg)) m, _ := mxj.NewMapXml(msg) - fmt.Println("m:",m.StringIndent()) + fmt.Println("m:", m.StringIndent()) path := "Envelope.Body.*.*.ClaimStatusCodeRecord" values, err := m.ValueForPath(path) if err != nil { @@ -130,9 +130,9 @@ func partPath1(msg []byte) { } func partPath2(msg []byte) { - fmt.Println("\nmsg:",string(msg)) + fmt.Println("\nmsg:", string(msg)) m, _ := mxj.NewMapXml(msg) - fmt.Println("m:",m.StringIndent()) + fmt.Println("m:", m.StringIndent()) path := "Envelope.Body.*.*.*" values, err := m.ValueForPath(path) if err != nil { @@ -152,9 +152,9 @@ func partPath2(msg []byte) { } func partPath3(msg []byte) { - fmt.Println("\nmsg:",string(msg)) + fmt.Println("\nmsg:", string(msg)) m, _ := mxj.NewMapXml(msg) - fmt.Println("m:",m.StringIndent()) + fmt.Println("m:", m.StringIndent()) path := "*.*.*.*.*" values, err := m.ValueForPath(path) if err != nil { @@ -174,9 +174,9 @@ func partPath3(msg []byte) { } func partPath4(msg []byte) { - fmt.Println("\nmsg:",string(msg)) + fmt.Println("\nmsg:", string(msg)) m, _ := mxj.NewMapXml(msg) - fmt.Println("m:",m.StringIndent()) + fmt.Println("m:", m.StringIndent()) path := "*.*.*.*.*.Description" values, err := m.ValueForPath(path) if err != nil { @@ -196,9 +196,9 @@ func partPath4(msg []byte) { } func partPath5(msg []byte) { - fmt.Println("\nmsg:",string(msg)) + fmt.Println("\nmsg:", string(msg)) m, _ := mxj.NewMapXml(msg) - fmt.Println("m:",m.StringIndent()) + fmt.Println("m:", m.StringIndent()) path := "*.*.*.*.*.*" values, err := m.ValueForPath(path) if err != nil { @@ -218,9 +218,9 @@ func partPath5(msg []byte) { } func partPath6(msg []byte) { - fmt.Println("\nmsg:",string(msg)) + fmt.Println("\nmsg:", string(msg)) m, _ := mxj.NewMapXml(msg) - fmt.Println("m:",m.StringIndent()) + fmt.Println("m:", m.StringIndent()) path := "*.*.*.*.*.*.*" values, err := m.ValueForPath(path) if err != nil { diff --git a/Godeps/_workspace/src/github.com/clbanning/mxj/examples/gonuts4.go b/Godeps/_workspace/src/github.com/clbanning/mxj/examples/gonuts4.go index 8dfc30fd4..5ad4f9df3 100644 --- a/Godeps/_workspace/src/github.com/clbanning/mxj/examples/gonuts4.go +++ b/Godeps/_workspace/src/github.com/clbanning/mxj/examples/gonuts4.go @@ -45,6 +45,6 @@ func main() { } for _, v := range values { - fmt.Println("v:",v) + fmt.Println("v:", v) } } diff --git a/Godeps/_workspace/src/github.com/clbanning/mxj/examples/gonuts6.go b/Godeps/_workspace/src/github.com/clbanning/mxj/examples/gonuts6.go index ee2b89803..56b3d29e2 100644 --- a/Godeps/_workspace/src/github.com/clbanning/mxj/examples/gonuts6.go +++ b/Godeps/_workspace/src/github.com/clbanning/mxj/examples/gonuts6.go @@ -41,4 +41,3 @@ func main() { } var s = []byte(`{ "DBInstances": [ { "PubliclyAccessible": true, "MasterUsername": "postgres", "LicenseModel": "postgresql-license", "VpcSecurityGroups": [ { "Status": "active", "VpcSecurityGroupId": "sg-e72a4282" } ], "InstanceCreateTime": "2014-06-29T03:52:59.268Z", "OptionGroupMemberships": [ { "Status": "in-sync", "OptionGroupName": "default:postgres-9-3" } ], "PendingModifiedValues": {}, "Engine": "postgres", "MultiAZ": true, "LatestRestorableTime": "2014-06-29T12:00:34Z", "DBSecurityGroups": [ { "Status": "active", "DBSecurityGroupName": "production-dbsecuritygroup-q4f0ugxpjck8" } ], "DBParameterGroups": [ { "DBParameterGroupName": "default.postgres9.3", "ParameterApplyStatus": "in-sync" } ], "AutoMinorVersionUpgrade": true, "PreferredBackupWindow": "06:59-07:29", "DBSubnetGroup": { "Subnets": [ { "SubnetStatus": "Active", "SubnetIdentifier": "subnet-34e5d01c", "SubnetAvailabilityZone": { "Name": "us-east-1b", "ProvisionedIopsCapable": false } }, { "SubnetStatus": "Active", "SubnetIdentifier": "subnet-50759d27", "SubnetAvailabilityZone": { "Name": "us-east-1c", "ProvisionedIopsCapable": false } }, { "SubnetStatus": "Active", "SubnetIdentifier": "subnet-450a1f03", "SubnetAvailabilityZone": { "Name": "us-east-1d", "ProvisionedIopsCapable": false } } ], "DBSubnetGroupName": "default", "VpcId": "vpc-acb86cc9", "DBSubnetGroupDescription": "default", "SubnetGroupStatus": "Complete" }, "SecondaryAvailabilityZone": "us-east-1b", "ReadReplicaDBInstanceIdentifiers": [], "AllocatedStorage": 15, "BackupRetentionPeriod": 1, "DBName": "deis", "PreferredMaintenanceWindow": "fri:05:52-fri:06:22", "Endpoint": { "Port": 5432, "Address": "production.cfk8mskkbkeu.us-east-1.rds.amazonaws.com" }, "DBInstanceStatus": "available", "EngineVersion": "9.3.3", "AvailabilityZone": "us-east-1c", "DBInstanceClass": "db.m1.small", "DBInstanceIdentifier": "production" } ] }`) - diff --git a/Godeps/_workspace/src/github.com/clbanning/mxj/files.go b/Godeps/_workspace/src/github.com/clbanning/mxj/files.go index 340302674..589711874 100644 --- a/Godeps/_workspace/src/github.com/clbanning/mxj/files.go +++ b/Godeps/_workspace/src/github.com/clbanning/mxj/files.go @@ -9,7 +9,7 @@ import ( type Maps []Map func NewMaps() Maps { - return make(Maps,0) + return make(Maps, 0) } type MapRaw struct { @@ -33,7 +33,7 @@ func NewMapsFromJsonFile(name string) (Maps, error) { } defer fh.Close() - am := make([]Map,0) + am := make([]Map, 0) for { m, raw, err := NewMapJsonReaderRaw(fh) if err != nil && err != io.EOF { @@ -65,7 +65,7 @@ func NewMapsFromJsonFileRaw(name string) ([]MapRaw, error) { } defer fh.Close() - am := make([]MapRaw,0) + am := make([]MapRaw, 0) for { mr := new(MapRaw) mr.M, mr.R, err = NewMapJsonReaderRaw(fh) @@ -104,7 +104,7 @@ func NewMapsFromXmlFile(name string) (Maps, error) { } defer fh.Close() - am := make([]Map,0) + am := make([]Map, 0) for { m, raw, err := NewMapXmlReaderRaw(fh) if err != nil && err != io.EOF { @@ -130,7 +130,6 @@ func NewMapsFromXmlFileRaw(name string) ([]MapRaw, error) { XmlWriterBufSize = x }() - fi, err := os.Stat(name) if err != nil { return nil, err @@ -145,7 +144,7 @@ func NewMapsFromXmlFileRaw(name string) ([]MapRaw, error) { } defer fh.Close() - am := make([]MapRaw,0) + am := make([]MapRaw, 0) for { mr := new(MapRaw) mr.M, mr.R, err = NewMapXmlReaderRaw(fh) @@ -298,4 +297,3 @@ func (mvs Maps) XmlFileIndent(file, prefix, indent string) error { fh.WriteString(s) return nil } - diff --git a/Godeps/_workspace/src/github.com/clbanning/mxj/files_test.go b/Godeps/_workspace/src/github.com/clbanning/mxj/files_test.go index 2850902f9..52778aef6 100644 --- a/Godeps/_workspace/src/github.com/clbanning/mxj/files_test.go +++ b/Godeps/_workspace/src/github.com/clbanning/mxj/files_test.go @@ -104,7 +104,7 @@ func TestNewXmFileRaw(t *testing.T) { func TestMaps(t *testing.T) { fmt.Println("TestMaps()") mvs := NewMaps() - for i := 0 ; i < 2 ; i++ { + for i := 0; i < 2; i++ { m, _ := NewMapJson([]byte(`{ "this":"is", "a":"test" }`)) mvs = append(mvs, m) } @@ -138,7 +138,7 @@ func TestJsonFile(t *testing.T) { } fmt.Println("files_test_dup.json written") - err = am.JsonFileIndent("files_test_indent.json","", " ") + err = am.JsonFileIndent("files_test_indent.json", "", " ") if err != nil { t.Fatal(err.Error()) } @@ -160,7 +160,7 @@ func TestXmlFile(t *testing.T) { } fmt.Println("files_test_dup.xml written") - err = am.XmlFileIndent("files_test_indent.xml","", " ") + err = am.XmlFileIndent("files_test_indent.xml", "", " ") if err != nil { t.Fatal(err.Error()) } diff --git a/Godeps/_workspace/src/github.com/clbanning/mxj/j2x/j2x.go b/Godeps/_workspace/src/github.com/clbanning/mxj/j2x/j2x.go index afb7109fb..868c55a5b 100644 --- a/Godeps/_workspace/src/github.com/clbanning/mxj/j2x/j2x.go +++ b/Godeps/_workspace/src/github.com/clbanning/mxj/j2x/j2x.go @@ -6,7 +6,6 @@ // Wrappers for end-to-end JSON to XML transformation and value manipulation. package j2x - import ( . "github.com/clbanning/mxj" "io" diff --git a/Godeps/_workspace/src/github.com/clbanning/mxj/j2x/j2x_test.go b/Godeps/_workspace/src/github.com/clbanning/mxj/j2x/j2x_test.go index 098f48220..4a25605cb 100644 --- a/Godeps/_workspace/src/github.com/clbanning/mxj/j2x/j2x_test.go +++ b/Godeps/_workspace/src/github.com/clbanning/mxj/j2x/j2x_test.go @@ -4,8 +4,8 @@ package j2x import ( "bytes" - "io/ioutil" "fmt" + "io/ioutil" "testing" ) diff --git a/Godeps/_workspace/src/github.com/clbanning/mxj/j2x_test.go b/Godeps/_workspace/src/github.com/clbanning/mxj/j2x_test.go index 4bbc7cb16..b88a64d57 100644 --- a/Godeps/_workspace/src/github.com/clbanning/mxj/j2x_test.go +++ b/Godeps/_workspace/src/github.com/clbanning/mxj/j2x_test.go @@ -27,4 +27,3 @@ func TestJ2X(t *testing.T) { fmt.Println("j2x, m :", m) fmt.Println("j2x, xml :", string(x)) } - diff --git a/Godeps/_workspace/src/github.com/clbanning/mxj/json.go b/Godeps/_workspace/src/github.com/clbanning/mxj/json.go index b7bf03309..34c1c0b33 100644 --- a/Godeps/_workspace/src/github.com/clbanning/mxj/json.go +++ b/Godeps/_workspace/src/github.com/clbanning/mxj/json.go @@ -124,7 +124,7 @@ var JsonUseNumber bool func NewMapJson(jsonVal []byte) (Map, error) { // empty or nil begets empty if len(jsonVal) == 0 { - m := make(map[string]interface{},0) + m := make(map[string]interface{}, 0) return m, nil } // handle a goofy case ... diff --git a/Godeps/_workspace/src/github.com/clbanning/mxj/keyvalues_test.go b/Godeps/_workspace/src/github.com/clbanning/mxj/keyvalues_test.go index a43bcb803..ad42a77c9 100644 --- a/Godeps/_workspace/src/github.com/clbanning/mxj/keyvalues_test.go +++ b/Godeps/_workspace/src/github.com/clbanning/mxj/keyvalues_test.go @@ -132,7 +132,7 @@ func TestValuesForKey(t *testing.T) { if sserr != nil { t.Fatal("sserr:", sserr.Error()) } - for _, v := range ss { // should be len(ss) == 0 + for _, v := range ss { // should be len(ss) == 0 fmt.Println("... ss.v:", v) } } @@ -189,7 +189,7 @@ func TestValuesForPath(t *testing.T) { } } -func TestValuesForNotKey( t *testing.T) { +func TestValuesForNotKey(t *testing.T) { fmt.Println("ValuesForNotKey ...") m, merr := NewMapXml(doc1) if merr != nil { @@ -209,7 +209,7 @@ func TestValuesForNotKey( t *testing.T) { if sserr != nil { t.Fatal("sserr:", sserr.Error()) } - for _, v := range ss { // expect len(ss) == 0 + for _, v := range ss { // expect len(ss) == 0 fmt.Println("... ss.v:", v) } diff --git a/Godeps/_workspace/src/github.com/clbanning/mxj/leafnode.go b/Godeps/_workspace/src/github.com/clbanning/mxj/leafnode.go index bbed685d0..99f271656 100644 --- a/Godeps/_workspace/src/github.com/clbanning/mxj/leafnode.go +++ b/Godeps/_workspace/src/github.com/clbanning/mxj/leafnode.go @@ -23,7 +23,7 @@ type LeafNode struct { // LeafNodes - returns an array of all LeafNode values for the Map. // The option no_attr argument suppresses attribute values (keys with prepended hyphen, '-') // as well as the "#text" key for the associated simple element value. -func (mv Map)LeafNodes(no_attr ...bool) []LeafNode { +func (mv Map) LeafNodes(no_attr ...bool) []LeafNode { var a bool if len(no_attr) == 1 { a = no_attr[0] @@ -64,8 +64,8 @@ func getLeafNodes(path, node string, mv interface{}, l *[]LeafNode, noattr bool) // LeafPaths - all paths that terminate in LeafNode values. func (mv Map) LeafPaths(no_attr ...bool) []string { ln := mv.LeafNodes() - ss := make([]string,len(ln)) - for i := 0 ; i < len(ln); i++ { + ss := make([]string, len(ln)) + for i := 0; i < len(ln); i++ { ss[i] = ln[i].Path } return ss @@ -74,8 +74,8 @@ func (mv Map) LeafPaths(no_attr ...bool) []string { // LeafValues - all terminal values in the Map. func (mv Map) LeafValues(no_attr ...bool) []interface{} { ln := mv.LeafNodes() - vv := make([]interface{},len(ln)) - for i := 0 ; i < len(ln); i++ { + vv := make([]interface{}, len(ln)) + for i := 0; i < len(ln); i++ { vv[i] = ln[i].Value } return vv diff --git a/Godeps/_workspace/src/github.com/clbanning/mxj/leafnode_test.go b/Godeps/_workspace/src/github.com/clbanning/mxj/leafnode_test.go index 7bf59b781..9cb9dd716 100644 --- a/Godeps/_workspace/src/github.com/clbanning/mxj/leafnode_test.go +++ b/Godeps/_workspace/src/github.com/clbanning/mxj/leafnode_test.go @@ -72,7 +72,6 @@ func TestLeafNodes(t *testing.T) { fmt.Printf("%#v\n", v) } - xmldata2 := []byte(` Item 2 is blue diff --git a/Godeps/_workspace/src/github.com/clbanning/mxj/mxj.go b/Godeps/_workspace/src/github.com/clbanning/mxj/mxj.go index 01a6754ef..8e90c32b3 100644 --- a/Godeps/_workspace/src/github.com/clbanning/mxj/mxj.go +++ b/Godeps/_workspace/src/github.com/clbanning/mxj/mxj.go @@ -38,7 +38,7 @@ func (mv Map) Old() map[string]interface{} { // be represented as a map[string]interface{} value. func (mv Map) Copy() (Map, error) { // this is the poor-man's deep copy - // not efficient, but it works + // not efficient, but it works j, jerr := mv.Json() // must handle, we don't know how mv got built if jerr != nil { diff --git a/Godeps/_workspace/src/github.com/clbanning/mxj/mxj_test.go b/Godeps/_workspace/src/github.com/clbanning/mxj/mxj_test.go index a0295b5ec..319e09e54 100644 --- a/Godeps/_workspace/src/github.com/clbanning/mxj/mxj_test.go +++ b/Godeps/_workspace/src/github.com/clbanning/mxj/mxj_test.go @@ -13,8 +13,8 @@ func TestMap(t *testing.T) { m := New() m["key"] = interface{}("value") - v := map[string]interface{}{ "bool":true, "float":3.14159, "string":"Now is the time" } - vv := []interface{}{ 3.1415962535, false, "for all good men" } + v := map[string]interface{}{"bool": true, "float": 3.14159, "string": "Now is the time"} + vv := []interface{}{3.1415962535, false, "for all good men"} v["listkey"] = interface{}(vv) m["newkey"] = interface{}(v) @@ -23,14 +23,14 @@ func TestMap(t *testing.T) { o := interface{}(m.Old()) switch o.(type) { - case map[string]interface{}: - // do nothing - default: - t.Fatal("invalid type for m.Old()") + case map[string]interface{}: + // do nothing + default: + t.Fatal("invalid type for m.Old()") } m, _ = NewMapXml([]byte(`HelloWorld`)) - fmt.Println("TestMap, m_fromXML:",m) + fmt.Println("TestMap, m_fromXML:", m) fmt.Println("TestMap, StringIndent:", m.StringIndent()) mm, _ := m.Copy() diff --git a/Godeps/_workspace/src/github.com/clbanning/mxj/newmap.go b/Godeps/_workspace/src/github.com/clbanning/mxj/newmap.go index e9c7f0cff..fc1320c00 100644 --- a/Godeps/_workspace/src/github.com/clbanning/mxj/newmap.go +++ b/Godeps/_workspace/src/github.com/clbanning/mxj/newmap.go @@ -22,9 +22,9 @@ import ( "strings" ) -// (Map)NewMap - create a new Map from data in the current Map. +// (Map)NewMap - create a new Map from data in the current Map. // 'keypairs' are key mappings "oldKey:newKey" and specify that the current value of 'oldKey' -// should be the value for 'newKey' in the returned Map. +// should be the value for 'newKey' in the returned Map. // - 'oldKey' supports dot-notation as described for (Map)ValuesForPath() // - 'newKey' supports dot-notation but with no wildcards, '*', or indexed arrays // - "oldKey" is shorthand for for the keypair value "oldKey:oldKey" @@ -32,7 +32,7 @@ import ( // - if 'oldKey' does not exist in the current Map, it is not written to the new Map. // "null" is not supported unless it is the current Map. // - see newmap_test.go for several syntax examples -// +// // NOTE: mv.NewMap() == mxj.New(). func (mv Map) NewMap(keypairs ...string) (Map, error) { n := make(map[string]interface{}, 0) @@ -67,7 +67,7 @@ func (mv Map) NewMap(keypairs ...string) (Map, error) { return n, errors.New("newKey value cannot contain indexed arrays - " + v) } if oldKey == "" || newKey == "" { - return n, errors.New("oldKey or newKey is not specified - " + v) + return n, errors.New("oldKey or newKey is not specified - " + v) } // get oldKey value @@ -125,7 +125,7 @@ func addNewVal(n *map[string]interface{}, path []string, val []interface{}) { // The placement of the next value in the array is dependent // on the sequence of members - could land on a map or a nil // value first. TODO: how to test this. - a := make([]interface{},0) + a := make([]interface{}, 0) var foundmap bool for _, vv := range m[k].([]interface{}) { switch vv.(type) { @@ -135,7 +135,7 @@ func addNewVal(n *map[string]interface{}, path []string, val []interface{}) { continue } nm = make(map[string]interface{}, 0) - a = append(a,interface{}(nm)) + a = append(a, interface{}(nm)) foundmap = true case map[string]interface{}: if foundmap { // use the first one in array @@ -151,7 +151,7 @@ func addNewVal(n *map[string]interface{}, path []string, val []interface{}) { } // no map found in array if !foundmap { - nm = make(map[string]interface{},0) + nm = make(map[string]interface{}, 0) a = append(a, interface{}(nm)) } m[k] = interface{}(a) // must insert in map @@ -178,6 +178,6 @@ func addNewVal(n *map[string]interface{}, path []string, val []interface{}) { default: // v exists:string, float64, bool, map[string]interface, etc. a := make([]interface{}, 0) a = append(a, v, newVal) - m[k] =interface{}(a) + m[k] = interface{}(a) } } diff --git a/Godeps/_workspace/src/github.com/clbanning/mxj/newmap_test.go b/Godeps/_workspace/src/github.com/clbanning/mxj/newmap_test.go index 0b2504612..7e3fdfea0 100644 --- a/Godeps/_workspace/src/github.com/clbanning/mxj/newmap_test.go +++ b/Godeps/_workspace/src/github.com/clbanning/mxj/newmap_test.go @@ -1,9 +1,9 @@ package mxj import ( - "io" "bytes" "fmt" + "io" "testing" ) @@ -18,7 +18,7 @@ func TestNewMap(t *testing.T) { m, _ := NewMapJson(j) fmt.Printf("m: %#v\n", m) - fmt.Println("\n",`eval - m.NewMap("A:AA", "B:BB", "C:cc", "D:help")`) + fmt.Println("\n", `eval - m.NewMap("A:AA", "B:BB", "C:cc", "D:help")`) n, err := m.NewMap("A:AA", "B:BB", "C:cc", "D:help") if err != nil { fmt.Println("err:", err.Error()) @@ -26,11 +26,11 @@ func TestNewMap(t *testing.T) { j, _ = n.Json() fmt.Println("n.Json():", string(j)) x, _ := n.Xml() - fmt.Println("n.Xml():\n",string(x)) + fmt.Println("n.Xml():\n", string(x)) x, _ = n.XmlIndent("", " ") - fmt.Println("n.XmlIndent():\n",string(x)) + fmt.Println("n.XmlIndent():\n", string(x)) - fmt.Println("\n",`eval - m.NewMap("A:AA.A", "B:AA.B", "C:AA.B.cc", "D:hello.help")`) + fmt.Println("\n", `eval - m.NewMap("A:AA.A", "B:AA.B", "C:AA.B.cc", "D:hello.help")`) n, err = m.NewMap("A:AA.A", "B:AA.B", "C:AA.B.cc", "D:hello.help") if err != nil { fmt.Println("err:", err.Error()) @@ -38,12 +38,12 @@ func TestNewMap(t *testing.T) { j, _ = n.Json() fmt.Println("n.Json():", string(j)) x, _ = n.Xml() - fmt.Println("n.Xml():\n",string(x)) + fmt.Println("n.Xml():\n", string(x)) x, _ = n.XmlIndent("", " ") - fmt.Println("n.XmlIndent():\n",string(x)) + fmt.Println("n.XmlIndent():\n", string(x)) - var keypairs = []string{ "A:xml.AA", "B:xml.AA.hello.again", "C:xml.AA", "D:xml.AA.hello.help" } - fmt.Println("\n",`eval - m.NewMap keypairs:`,keypairs) + var keypairs = []string{"A:xml.AA", "B:xml.AA.hello.again", "C:xml.AA", "D:xml.AA.hello.help"} + fmt.Println("\n", `eval - m.NewMap keypairs:`, keypairs) n, err = m.NewMap(keypairs...) if err != nil { fmt.Println("err:", err.Error()) @@ -51,9 +51,9 @@ func TestNewMap(t *testing.T) { j, _ = n.Json() fmt.Println("n.Json():", string(j)) x, _ = n.Xml() - fmt.Println("n.Xml():\n",string(x)) + fmt.Println("n.Xml():\n", string(x)) x, _ = n.XmlIndent("", " ") - fmt.Println("n.XmlIndent():\n",string(x)) + fmt.Println("n.XmlIndent():\n", string(x)) } // Need to normalize from an XML stream the values for "netid" and "idnet". diff --git a/Godeps/_workspace/src/github.com/clbanning/mxj/seqnum_test.go b/Godeps/_workspace/src/github.com/clbanning/mxj/seqnum_test.go index 208eb27f3..7b48a7ca9 100644 --- a/Godeps/_workspace/src/github.com/clbanning/mxj/seqnum_test.go +++ b/Godeps/_workspace/src/github.com/clbanning/mxj/seqnum_test.go @@ -30,7 +30,7 @@ func TestSeqNumHeader(t *testing.T) { } func TestSeqNum(t *testing.T) { - IncludeTagSeqNum( true ) + IncludeTagSeqNum(true) m, err := NewMapXml(seqdata1, Cast) if err != nil { @@ -48,5 +48,5 @@ func TestSeqNum(t *testing.T) { j, _ = m.JsonIndent("", " ") fmt.Println(string(j)) - IncludeTagSeqNum( false ) + IncludeTagSeqNum(false) } diff --git a/Godeps/_workspace/src/github.com/clbanning/mxj/struct_test.go b/Godeps/_workspace/src/github.com/clbanning/mxj/struct_test.go index 91af0f6ea..799de778d 100644 --- a/Godeps/_workspace/src/github.com/clbanning/mxj/struct_test.go +++ b/Godeps/_workspace/src/github.com/clbanning/mxj/struct_test.go @@ -11,29 +11,29 @@ func TestStructHeader(t *testing.T) { func TestNewMapStruct(t *testing.T) { type str struct { - IntVal int `json:"int"` - StrVal string `json:"str"` + IntVal int `json:"int"` + StrVal string `json:"str"` FloatVal float64 `json:"float"` - BoolVal bool `json:"bool"` - private string + BoolVal bool `json:"bool"` + private string } - s := str{ IntVal:4, StrVal:"now's the time", FloatVal:3.14159, BoolVal:true, private:"It's my party" } + s := str{IntVal: 4, StrVal: "now's the time", FloatVal: 3.14159, BoolVal: true, private: "It's my party"} m, merr := NewMapStruct(s) if merr != nil { t.Fatal("merr:", merr.Error()) } - fmt.Printf("NewMapStruct, s: %#v\n",s) - fmt.Printf("NewMapStruct, m: %#v\n",m) + fmt.Printf("NewMapStruct, s: %#v\n", s) + fmt.Printf("NewMapStruct, m: %#v\n", m) m, merr = NewMapStruct(s) if merr != nil { t.Fatal("merr:", merr.Error()) } - fmt.Printf("NewMapStruct, s: %#v\n",s) - fmt.Printf("NewMapStruct, m: %#v\n",m) + fmt.Printf("NewMapStruct, s: %#v\n", s) + fmt.Printf("NewMapStruct, m: %#v\n", m) } func TestNewMapStructError(t *testing.T) { @@ -43,38 +43,38 @@ func TestNewMapStructError(t *testing.T) { t.Fatal("NewMapStructError, merr is nil") } - fmt.Println("NewMapStructError, merr:",merr.Error()) + fmt.Println("NewMapStructError, merr:", merr.Error()) } func TestStruct(t *testing.T) { type str struct { - IntVal int `json:"int"` - StrVal string `json:"str"` + IntVal int `json:"int"` + StrVal string `json:"str"` FloatVal float64 `json:"float"` - BoolVal bool `json:"bool"` - private string + BoolVal bool `json:"bool"` + private string } var s str - m := Map{ "int":4, "str":"now's the time", "float":3.14159, "bool":true, "private":"Somewhere over the rainbow" } + m := Map{"int": 4, "str": "now's the time", "float": 3.14159, "bool": true, "private": "Somewhere over the rainbow"} mverr := m.Struct(&s) if mverr != nil { t.Fatal("mverr:", mverr.Error()) } - fmt.Printf("Struct, m: %#v\n",m) - fmt.Printf("Struct, s: %#v\n",s) + fmt.Printf("Struct, m: %#v\n", m) + fmt.Printf("Struct, s: %#v\n", s) } func TestStructError(t *testing.T) { type str struct { - IntVal int `json:"int"` - StrVal string `json:"str"` + IntVal int `json:"int"` + StrVal string `json:"str"` FloatVal float64 `json:"float"` - BoolVal bool `json:"bool"` + BoolVal bool `json:"bool"` } var s str - mv := Map{ "int":4, "str":"now's the time", "float":3.14159, "bool":true } + mv := Map{"int": 4, "str": "now's the time", "float": 3.14159, "bool": true} mverr := mv.Struct(s) if mverr == nil { @@ -82,4 +82,3 @@ func TestStructError(t *testing.T) { } fmt.Println("StructError, mverr:", mverr.Error()) } - diff --git a/Godeps/_workspace/src/github.com/clbanning/mxj/updatevalues_test.go b/Godeps/_workspace/src/github.com/clbanning/mxj/updatevalues_test.go index 53f084716..dca2da91b 100644 --- a/Godeps/_workspace/src/github.com/clbanning/mxj/updatevalues_test.go +++ b/Godeps/_workspace/src/github.com/clbanning/mxj/updatevalues_test.go @@ -11,7 +11,6 @@ func TestUVHeader(t *testing.T) { fmt.Println("\n---------------- updatevalues_test.go ...\n") } - func TestUpdateValuesForPath_Author(t *testing.T) { m, merr := NewMapXml(doc1) if merr != nil { @@ -71,7 +70,7 @@ func TestUpdateValuesForPath_Author(t *testing.T) { fmt.Println("m:", m) fmt.Println("m.UpdateValuesForPath(mm, \"*\")") - mm, _ := NewMapXml(doc1) + mm, _ := NewMapXml(doc1) n, err = m.UpdateValuesForPath(mm, "*") if err != nil { t.Fatal("err:", err.Error()) @@ -83,7 +82,7 @@ func TestUpdateValuesForPath_Author(t *testing.T) { var newDoc = []byte(`simple element`) m, merr = NewMapXml(newDoc) if merr != nil { - t.Fatal("merr:",merr.Error()) + t.Fatal("merr:", merr.Error()) } fmt.Println("\nnewDoc:", string(newDoc)) fmt.Println("m:", m) @@ -94,29 +93,29 @@ func TestUpdateValuesForPath_Author(t *testing.T) { n, _ = m.UpdateValuesForPath("#text:simple element again", "*") fmt.Println("n:", n, "m:", m) -/* - fmt.Println("UpdateValuesForPath, doc.books.book, title:The Recognitions : NoBook") - n, err = m.UpdateValuesForPath("NoBook", "doc.books.book", "title:The Recognitions") - if err != nil { - t.Fatal("err:", err.Error()) - } - fmt.Println(n, "updates") - ss, _ = m.ValuesForPath("doc.books.book") - for _, v := range ss { - fmt.Println("v:", v) - } + /* + fmt.Println("UpdateValuesForPath, doc.books.book, title:The Recognitions : NoBook") + n, err = m.UpdateValuesForPath("NoBook", "doc.books.book", "title:The Recognitions") + if err != nil { + t.Fatal("err:", err.Error()) + } + fmt.Println(n, "updates") + ss, _ = m.ValuesForPath("doc.books.book") + for _, v := range ss { + fmt.Println("v:", v) + } - fmt.Println("UpdateValuesForPath, doc.books.book.title -seq=3: The Blood Oranges") - n, err = m.UpdateValuesForPath("The Blood Oranges", "doc.books.book.title", "-seq:3") - if err != nil { - t.Fatal("err:", err.Error()) - } - fmt.Println(n, "updates") - ss, _ = m.ValuesForPath("doc.books.book.title") - for _, v := range ss { - fmt.Println("v:", v) - } -*/ + fmt.Println("UpdateValuesForPath, doc.books.book.title -seq=3: The Blood Oranges") + n, err = m.UpdateValuesForPath("The Blood Oranges", "doc.books.book.title", "-seq:3") + if err != nil { + t.Fatal("err:", err.Error()) + } + fmt.Println(n, "updates") + ss, _ = m.ValuesForPath("doc.books.book.title") + for _, v := range ss { + fmt.Println("v:", v) + } + */ } var authorDoc = []byte(` @@ -160,7 +159,7 @@ var authorDoc = []byte(` func TestAuthorDoc(t *testing.T) { m, merr := NewMapXml(authorDoc) - if merr != nil { + if merr != nil { t.Fatal("merr:", merr.Error()) } fmt.Println(m.StringIndent()) @@ -175,7 +174,7 @@ func TestAuthorDoc(t *testing.T) { fmt.Println("m.UpdateValuesForPath(newVal, path, oldVal)") path := m.PathForKeyShortest("date") - v,_ := m.ValuesForPath(path) + v, _ := m.ValuesForPath(path) var counter int for _, vv := range v { oldVal := "date:" + vv.(string) @@ -186,5 +185,3 @@ func TestAuthorDoc(t *testing.T) { fmt.Println(counter, "updates") fmt.Println(m.StringIndent()) } - - diff --git a/Godeps/_workspace/src/github.com/clbanning/mxj/x2j/x2j.go b/Godeps/_workspace/src/github.com/clbanning/mxj/x2j/x2j.go index dad3f0aa7..5891aa1df 100644 --- a/Godeps/_workspace/src/github.com/clbanning/mxj/x2j/x2j.go +++ b/Godeps/_workspace/src/github.com/clbanning/mxj/x2j/x2j.go @@ -38,7 +38,7 @@ func XmlToJson(xmlVal []byte, safeEncoding ...bool) ([]byte, error) { func XmlToJsonWriter(xmlVal []byte, jsonWriter io.Writer, safeEncoding ...bool) ([]byte, error) { m, err := NewMapXml(xmlVal) if err != nil { - return nil, err + return nil, err } return m.JsonWriterRaw(jsonWriter, safeEncoding...) } diff --git a/Godeps/_workspace/src/github.com/clbanning/mxj/xml_test.go b/Godeps/_workspace/src/github.com/clbanning/mxj/xml_test.go index fc60d6516..955923df7 100644 --- a/Godeps/_workspace/src/github.com/clbanning/mxj/xml_test.go +++ b/Godeps/_workspace/src/github.com/clbanning/mxj/xml_test.go @@ -79,7 +79,7 @@ func TestNewMapXmlReader(t *testing.T) { // --------------------- Xml() and XmlWriter() test cases ------------------- func TestXml_1(t *testing.T) { - mv := Map{"tag1": "some data", "tag2": "more data", "boolean": true, "float": 3.14159625, "null":nil} + mv := Map{"tag1": "some data", "tag2": "more data", "boolean": true, "float": 3.14159625, "null": nil} x, err := mv.Xml() if err != nil { @@ -91,8 +91,8 @@ func TestXml_1(t *testing.T) { } func TestXml_2(t *testing.T) { - a := []interface{}{ "string", true, 36.4 } - mv := Map{"array": a } + a := []interface{}{"string", true, 36.4} + mv := Map{"array": a} x, err := mv.Xml() if err != nil { @@ -104,8 +104,8 @@ func TestXml_2(t *testing.T) { } func TestXml_3(t *testing.T) { - a := []interface{}{ "string", true, 36.4 } - mv := Map{"array": []interface{}{a, "string2"} } + a := []interface{}{"string", true, 36.4} + mv := Map{"array": []interface{}{a, "string2"}} x, err := mv.Xml() if err != nil { @@ -117,8 +117,8 @@ func TestXml_3(t *testing.T) { } func TestXml_4(t *testing.T) { - a := []interface{}{ "string", true, 36.4 } - mv := Map{"array": map[string]interface{}{ "innerkey": []interface{}{a, "string2"} } } + a := []interface{}{"string", true, 36.4} + mv := Map{"array": map[string]interface{}{"innerkey": []interface{}{a, "string2"}}} x, err := mv.Xml() if err != nil { @@ -130,8 +130,8 @@ func TestXml_4(t *testing.T) { } func TestXml_5(t *testing.T) { - a := []interface{}{ "string", true, 36.4 } - mv := Map{"array": []interface{}{ map[string]interface{}{ "innerkey": []interface{}{a, "string2"} }, map[string]interface{}{"some":"more"} } } + a := []interface{}{"string", true, 36.4} + mv := Map{"array": []interface{}{map[string]interface{}{"innerkey": []interface{}{a, "string2"}}, map[string]interface{}{"some": "more"}}} x, err := mv.Xml() if err != nil { @@ -148,10 +148,10 @@ func TestXmlWriter(t *testing.T) { raw, err := mv.XmlWriterRaw(w, "myRootTag") if err != nil { - t.Fatal("err:",err.Error()) + t.Fatal("err:", err.Error()) } - b := make([]byte,w.Len()) + b := make([]byte, w.Len()) _, err = w.Read(b) if err != nil { t.Fatal("err:", err.Error()) diff --git a/Makefile b/Makefile index 14dd7d214..0cec64d98 100644 --- a/Makefile +++ b/Makefile @@ -11,7 +11,7 @@ checkgopath: @if [ ! -d ${MINIOPATH} ]; then echo "Project not found in $GOPATH, please follow instructions provided at https://github.com/Minio-io/minio/blob/master/CONTRIBUTING.md#setup-your-minio-github-repository" && exit 1; fi getdeps: checkdeps checkgopath - @go get github.com/tools/godep && echo "Installed godep:" + @go get github.com/minio-io/godep && echo "Installed godep:" @go get github.com/golang/lint/golint && echo "Installed golint:" @go get golang.org/x/tools/cmd/vet && echo "Installed vet:" @go get github.com/fzipp/gocyclo && echo "Installed gocyclo:"