Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(3)

Delta Between Two Patch Sets: src/pkg/encoding/json/encode.go

Issue 6938045: code review 6938045: encoding/json: fix type assertion in error path (Closed)
Left Patch Set: diff -r 7e135713451d https://code.google.com/p/go Created 11 years, 3 months ago
Right Patch Set: diff -r 7e135713451d https://code.google.com/p/go Created 11 years, 3 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « src/pkg/encoding/json/decode_test.go ('k') | src/pkg/encoding/json/encode_test.go » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 // Copyright 2010 The Go Authors. All rights reserved. 1 // Copyright 2010 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style 2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file. 3 // license that can be found in the LICENSE file.
4 4
5 // Package json implements encoding and decoding of JSON objects as defined in 5 // Package json implements encoding and decoding of JSON objects as defined in
6 // RFC 4627. 6 // RFC 4627.
7 // 7 //
8 // See "JSON and Go" for an introduction to this package: 8 // See "JSON and Go" for an introduction to this package:
9 // http://golang.org/doc/articles/json_and_go.html 9 // http://golang.org/doc/articles/json_and_go.html
10 package json 10 package json
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 switch r := r.(type) { 217 switch r := r.(type) {
218 case error: 218 case error:
219 err = r 219 err = r
220 case string: 220 case string:
221 err = errors.New(r) 221 err = errors.New(r)
222 default: 222 default:
223 panic(r) 223 panic(r)
224 } 224 }
225 } 225 }
226 }() 226 }()
227
227 e.reflectValue(reflect.ValueOf(v)) 228 e.reflectValue(reflect.ValueOf(v))
228 return nil 229 return nil
229 } 230 }
230 231
231 func (e *encodeState) error(err error) { 232 func (e *encodeState) error(err error) {
232 panic(err) 233 panic(err)
233 } 234 }
234 235
235 var byteSliceType = reflect.TypeOf([]byte(nil)) 236 var byteSliceType = reflect.TypeOf([]byte(nil))
236 237
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after
698 } 699 }
699 700
700 fieldCache.Lock() 701 fieldCache.Lock()
701 if fieldCache.m == nil { 702 if fieldCache.m == nil {
702 fieldCache.m = map[reflect.Type][]field{} 703 fieldCache.m = map[reflect.Type][]field{}
703 } 704 }
704 fieldCache.m[t] = f 705 fieldCache.m[t] = f
705 fieldCache.Unlock() 706 fieldCache.Unlock()
706 return f 707 return f
707 } 708 }
LEFTRIGHT

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b