pkg/index: pull a []byte literal out into a global

Change-Id: Ibf36b7ddde01aa1e444981e8d9c1af103cc48501
This commit is contained in:
Brad Fitzpatrick 2018-01-30 16:49:43 -08:00
parent 6e8a5930c9
commit 66353d17bf
1 changed files with 2 additions and 1 deletions

View File

@ -795,6 +795,8 @@ func (c *Corpus) mergeImageSizeRow(k, v []byte) error {
return nil
}
var sha1Prefix = []byte("sha1-")
// "wholetofile|sha1-17b53c7c3e664d3613dfdce50ef1f2a09e8f04b5|sha1-fb88f3eab3acfcf3cfc8cd77ae4366f6f975d227" -> "1"
func (c *Corpus) mergeWholeToFileRow(k, v []byte) error {
pair := k[len("wholetofile|"):]
@ -809,7 +811,6 @@ func (c *Corpus) mergeWholeToFileRow(k, v []byte) error {
}
c.fileWholeRef[fileRef] = wholeRef
if c.building && !c.hasLegacySHA1 {
sha1Prefix := []byte("sha1-")
if bytes.HasPrefix(pair, sha1Prefix) {
c.hasLegacySHA1 = true
}