MCPcopy
hub / github.com/uber-go/zap / addElementSeparator

Method addElementSeparator

zapcore/json_encoder.go:455–469  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

453}
454
455func (enc *jsonEncoder) addElementSeparator() {
456 last := enc.buf.Len() - 1
457 if last < 0 {
458 return
459 }
460 switch enc.buf.Bytes()[last] {
461 case '{', '[', ':', ',', ' ':
462 return
463 default:
464 enc.buf.AppendByte(',')
465 if enc.spaced {
466 enc.buf.AppendByte(' ')
467 }
468 }
469}
470
471func (enc *jsonEncoder) appendFloat(val float64, bitSize int) {
472 enc.addElementSeparator()

Callers 13

AppendArrayMethod · 0.95
AppendObjectMethod · 0.95
AppendBoolMethod · 0.95
AppendByteStringMethod · 0.95
appendComplexMethod · 0.95
AppendInt64Method · 0.95
AppendReflectedMethod · 0.95
AppendStringMethod · 0.95
AppendTimeLayoutMethod · 0.95
AppendUint64Method · 0.95
addKeyMethod · 0.95
appendFloatMethod · 0.95

Calls 3

BytesMethod · 0.80
AppendByteMethod · 0.80
LenMethod · 0.45

Tested by

no test coverage detected