Merge lp:~niemeyer/goyaml/scalar-skipping into lp:~gophers/goyaml/trunk

Proposed by Gustavo Niemeyer
Status: Merged
Merged at revision: 33
Proposed branch: lp:~niemeyer/goyaml/scalar-skipping
Merge into: lp:~gophers/goyaml/trunk
Diff against target: 24 lines (+1/-2)
2 files modified
decode.go (+0/-2)
decode_test.go (+1/-0)
To merge this branch: bzr merge lp:~niemeyer/goyaml/scalar-skipping
Reviewer Review Type Date Requested Status
The Go Language Gophers Pending
Review via email: mp+86592@code.launchpad.net

Description of the change

Skip scalars when decoding onto unsupported types.

https://codereview.appspot.com/5505058/

To post a comment you must log in.
Revision history for this message
Gustavo Niemeyer (niemeyer) wrote :

Please take a look.

Revision history for this message
Gustavo Niemeyer (niemeyer) wrote :

Reviewers: mp+86592_code.launchpad.net,

Message:
Please take a look.

Description:

https://code.launchpad.net/~niemeyer/goyaml/scalar-skipping/+merge/86592

(do not edit description out of merge proposal)

Please review this at https://codereview.appspot.com/5505058/

Affected files:
   M decode.go
   M decode_test.go

Index: decode.go
=== <email address hidden> >
<email address hidden>
=== modified file 'decode.go'
--- decode.go 2011-12-20 13:36:25 +0000
+++ decode.go 2011-12-21 17:47:08 +0000
@@ -360,8 +360,6 @@
     out.Set(reflect.Zero(out.Type()))
     good = true
    }
- default:
- panic("Can't handle type yet: " + out.Type().String())
   }
   return good
  }

Index: decode_test.go
=== <email address hidden> >
<email address hidden>
=== modified file 'decode_test.go'
--- decode_test.go 2011-12-20 13:42:58 +0000
+++ decode_test.go 2011-12-21 17:47:08 +0000
@@ -85,6 +85,7 @@
   {"a: {b: c}", &struct{ A *struct{ B string } }{&struct{ B string }{"c"}}},
   {"a: {b: c}", &struct{ A map[string]string
}{map[string]string{"b": "c"}}},
   {"a: {b: c}", &struct{ A *map[string]string
}{&map[string]string{"b": "c"}}},
+ {"a:", &struct{ A map[string]string }{}},
   {"a: 1", &struct{ A int }{1}},
   {"a: [1, 2]", &struct{ A []int }{[]int{1, 2}}},
   {"a: 1", &struct{ B int }{0}},

Revision history for this message
Gustavo Niemeyer (niemeyer) wrote :

*** Submitted:

Skip scalars when decoding onto unsupported types.

R=
CC=
https://codereview.appspot.com/5505058

https://codereview.appspot.com/5505058/

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'decode.go'
2--- decode.go 2011-12-20 13:36:25 +0000
3+++ decode.go 2011-12-21 17:51:56 +0000
4@@ -360,8 +360,6 @@
5 out.Set(reflect.Zero(out.Type()))
6 good = true
7 }
8- default:
9- panic("Can't handle type yet: " + out.Type().String())
10 }
11 return good
12 }
13
14=== modified file 'decode_test.go'
15--- decode_test.go 2011-12-20 13:42:58 +0000
16+++ decode_test.go 2011-12-21 17:51:56 +0000
17@@ -85,6 +85,7 @@
18 {"a: {b: c}", &struct{ A *struct{ B string } }{&struct{ B string }{"c"}}},
19 {"a: {b: c}", &struct{ A map[string]string }{map[string]string{"b": "c"}}},
20 {"a: {b: c}", &struct{ A *map[string]string }{&map[string]string{"b": "c"}}},
21+ {"a:", &struct{ A map[string]string }{}},
22 {"a: 1", &struct{ A int }{1}},
23 {"a: [1, 2]", &struct{ A []int }{[]int{1, 2}}},
24 {"a: 1", &struct{ B int }{0}},

Subscribers

People subscribed via source and target branches