MCPcopy
hub / github.com/go-yaml/yaml / Encode

Method Encode

yaml.go:249–253  ·  view source on GitHub ↗

Encode writes the YAML encoding of v to the stream. If multiple items are encoded to the stream, the second and subsequent document will be preceded with a "---" document separator, but the first will not. See the documentation for Marshal for details about the conversion of Go values to YAML.

(v interface{})

Source from the content-addressed store, hash-verified

247// See the documentation for Marshal for details about the conversion of Go
248// values to YAML.
249func (e *Encoder) Encode(v interface{}) (err error) {
250 defer handleErr(&err)
251 e.encoder.marshalDoc("", reflect.ValueOf(v))
252 return nil
253}
254
255// Encode encodes value v and stores its representation in n.
256//

Callers 6

TestEncoderWriteErrorMethod · 0.95
TestSetIndentMethod · 0.95
TestNodeRoundtripMethod · 0.95
TestSetStringMethod · 0.95

Calls 2

handleErrFunction · 0.85
marshalDocMethod · 0.80

Tested by 6

TestEncoderWriteErrorMethod · 0.76
TestSetIndentMethod · 0.76
TestNodeRoundtripMethod · 0.76
TestSetStringMethod · 0.76