MCPcopy Create free account
hub / github.com/prometheus/common / writeInt

Function writeInt

expfmt/text_create.go:502–508  ·  view source on GitHub ↗

writeInt is equivalent to fmt.Fprint with an int64 argument but uses strconv.AppendInt with a byte slice taken from a sync.Pool to avoid allocations.

(w enhancedWriter, i int64)

Source from the content-addressed store, hash-verified

500// strconv.AppendInt with a byte slice taken from a sync.Pool to avoid
501// allocations.
502func writeInt(w enhancedWriter, i int64) (int, error) {
503 bp := numBufPool.Get().(*[]byte)
504 *bp = strconv.AppendInt((*bp)[:0], i, 10)
505 written, err := w.Write(*bp)
506 numBufPool.Put(bp)
507 return written, err
508}
509
510// writeName writes a string as-is if it complies with the legacy naming
511// scheme, or escapes it in double quotes if not.

Callers 1

writeSampleFunction · 0.85

Calls 2

GetMethod · 0.80
PutMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…