Fix composite literal uses unkeyed fields

This commit is contained in:
Harshavardhana
2015-03-22 20:14:53 -07:00
parent 25969ef87a
commit 03248884de
3 changed files with 6 additions and 9 deletions
+1 -1
View File
@@ -34,7 +34,7 @@ const (
// printBuckets lists buckets and its meta-dat
func printBuckets(v []*client.Bucket) {
for _, b := range v {
msg := fmt.Sprintf("%23s %13s %s", b.CreationDate.Local().Format(printDate), "", b.Name)
msg := fmt.Sprintf("%23s %13s %s", b.CreationDate.Time.Local().Format(printDate), "", b.Name)
info(msg)
}
}
+1 -1
View File
@@ -29,7 +29,7 @@ const (
// XMLTime - time wrapper
type XMLTime struct {
time.Time
Time time.Time
}
// UnmarshalXML - unmarshal incoming xml
+4 -7
View File
@@ -64,14 +64,11 @@ func TestParseBuckets(t *testing.T) {
t.Errorf("num parsed buckets = %d; want %d", g, w)
}
t1, err := time.Parse(iso8601Format, "2006-06-21T07:04:31.000Z")
t2, err := time.Parse(iso8601Format, "2006-06-21T07:04:32.000Z")
xmlT1 := client.XMLTime{t1}
xmlT2 := client.XMLTime{t2}
t1, _ := time.Parse(iso8601Format, "2006-06-21T07:04:31.000Z")
t2, _ := time.Parse(iso8601Format, "2006-06-21T07:04:32.000Z")
want := []*client.Bucket{
{Name: "bucketOne", CreationDate: xmlT1},
{Name: "bucketTwo", CreationDate: xmlT2},
{Name: "bucketOne", CreationDate: client.XMLTime{Time: t1}},
{Name: "bucketTwo", CreationDate: client.XMLTime{Time: t2}},
}
dump := func(v []*client.Bucket) {
for i, b := range v {