MCPcopy Index your code
hub / github.com/perkeep/perkeep / StringMinusOne

Method StringMinusOne

pkg/blob/ref.go:86–97  ·  view source on GitHub ↗

StringMinusOne returns the first string that's before String.

()

Source from the content-addressed store, hash-verified

84
85// StringMinusOne returns the first string that's before String.
86func (r Ref) StringMinusOne() string {
87 if r.digest == nil {
88 return "<invalid-blob.Ref>"
89 }
90 dname := r.digest.digestName()
91 bs := r.digest.bytes()
92 buf := getBuf(len(dname) + 1 + len(bs)*2)[:0]
93 defer putBuf(buf)
94 buf = r.appendString(buf)
95 buf[len(buf)-1]-- // no need to deal with carrying underflow (no 0 bytes ever)
96 return string(buf)
97}
98
99// EqualString reports whether r.String() is equal to s.
100// It does not allocate.

Callers 3

StreamBlobsMethod · 0.95
TestRefStringMinusOneFunction · 0.80
StreamBlobsMethod · 0.80

Calls 5

appendStringMethod · 0.95
getBufFunction · 0.70
putBufFunction · 0.70
digestNameMethod · 0.65
bytesMethod · 0.65

Tested by 1

TestRefStringMinusOneFunction · 0.64