MCPcopy
hub / github.com/chrislusf/glow / EncodeData

Function EncodeData

netchan/encode_decode.go:24–31  ·  view source on GitHub ↗
(t reflect.Value)

Source from the content-addressed store, hash-verified

22}
23
24func EncodeData(t reflect.Value) ([]byte, error) {
25 var buf bytes.Buffer
26 enc := gob.NewEncoder(&buf)
27 if err := enc.EncodeValue(t); err != nil {
28 return nil, fmt.Errorf("data type: %s kind: %s encode error: %v", t.Type().String(), t.Kind(), err)
29 }
30 return buf.Bytes(), nil
31}

Callers 3

TestStructFunction · 0.85
TestNormalFunction · 0.85

Calls 2

BytesMethod · 0.80
StringMethod · 0.45

Tested by 2

TestStructFunction · 0.68
TestNormalFunction · 0.68