MCPcopy
hub / github.com/kubernetes-sigs/kwok / Encode

Method Encode

pkg/utils/yaml/encoder.go:40–59  ·  view source on GitHub ↗

Encode prints the object as YAML.

(obj any)

Source from the content-addressed store, hash-verified

38
39// Encode prints the object as YAML.
40func (p *Encoder) Encode(obj any) error {
41 count := atomic.AddInt64(&p.printCount, 1)
42 if count > 1 {
43 if _, err := p.w.Write(separator); err != nil {
44 return err
45 }
46 }
47
48 output, err := Marshal(obj)
49 if err != nil {
50 return err
51 }
52
53 _, err = p.w.Write(output)
54 if err != nil {
55 return err
56 }
57
58 return nil
59}

Callers 8

TestEncoderFunction · 0.95
ScaleFunction · 0.95
TestStageCRsFunction · 0.80
prometheusDiscoveryMethod · 0.80
renderMethod · 0.80
EncodeKubeconfigFunction · 0.80
SaveMethod · 0.80
RecordMethod · 0.80

Calls 2

MarshalFunction · 0.85
WriteMethod · 0.45

Tested by 2

TestEncoderFunction · 0.76
TestStageCRsFunction · 0.64