MCPcopy Create free account
hub / github.com/blues/note / marshal

Method marshal

jsonxt/encode.go:297–309  ·  view source on GitHub ↗
(v interface{}, opts encOpts)

Source from the content-addressed store, hash-verified

295type jsonError struct{ error }
296
297func (e *encodeState) marshal(v interface{}, opts encOpts) (err error) {
298 defer func() {
299 if r := recover(); r != nil {
300 if je, ok := r.(jsonError); ok {
301 err = je.error
302 } else {
303 panic(r)
304 }
305 }
306 }()
307 e.reflectValue(reflect.ValueOf(v), opts)
308 return nil
309}
310
311// error aborts the encoding by panicking with err wrapped in jsonError.
312func (e *encodeState) error(err error) {

Callers 2

EncodeMethod · 0.80
MarshalFunction · 0.80

Calls 1

reflectValueMethod · 0.95

Tested by

no test coverage detected