MCPcopy
hub / github.com/golang/protobuf / Write

Method Write

proto/text_test.go:576–586  ·  view source on GitHub ↗
(p []byte)

Source from the content-addressed store, hash-verified

574var outOfSpace = errors.New("proto: insufficient space")
575
576func (w *limitedWriter) Write(p []byte) (n int, err error) {
577 var avail = w.limit - w.b.Len()
578 if avail <= 0 {
579 return 0, outOfSpace
580 }
581 if len(p) <= avail {
582 return w.b.Write(p)
583 }
584 n, _ = w.b.Write(p[:avail])
585 return n, outOfSpace
586}
587
588func TestMarshalTextFailing(t *testing.T) {
589 // Try lots of different sizes to exercise more error code-paths.

Callers

nothing calls this directly

Calls 1

LenMethod · 0.45

Tested by

no test coverage detected