MCPcopy
hub / github.com/perkeep/perkeep / appendString

Method appendString

pkg/blob/ref.go:109–121  ·  view source on GitHub ↗
(buf []byte)

Source from the content-addressed store, hash-verified

107func (r Ref) HasPrefix(s string) bool { return r.digest.hasPrefix(s) }
108
109func (r Ref) appendString(buf []byte) []byte {
110 dname := r.digest.digestName()
111 bs := r.digest.bytes()
112 buf = append(buf, dname...)
113 buf = append(buf, '-')
114 for _, b := range bs {
115 buf = append(buf, hexDigit[b>>4], hexDigit[b&0xf])
116 }
117 if o, ok := r.digest.(otherDigest); ok && o.odd {
118 buf = buf[:len(buf)-1]
119 }
120 return buf
121}
122
123// HashName returns the lowercase hash function name of the reference.
124// It panics if r is zero.

Callers 3

StringMethod · 0.95
StringMinusOneMethod · 0.95
MarshalJSONMethod · 0.95

Calls 2

digestNameMethod · 0.65
bytesMethod · 0.65

Tested by

no test coverage detected