diff options
Diffstat (limited to 'src/internal/pkgbits/decoder.go')
| -rw-r--r-- | src/internal/pkgbits/decoder.go | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/internal/pkgbits/decoder.go b/src/internal/pkgbits/decoder.go index 9c8ad446ca..5b4e8f69af 100644 --- a/src/internal/pkgbits/decoder.go +++ b/src/internal/pkgbits/decoder.go @@ -22,7 +22,7 @@ type PkgDecoder struct { elemEndsEnds [numRelocs]uint32 elemEnds []uint32 - elemData string + elemData string // last 8 bytes are fingerprint } func (pr *PkgDecoder) PkgPath() string { return pr.pkgPath } @@ -50,7 +50,7 @@ func NewPkgDecoder(pkgPath, input string) PkgDecoder { assert(err == nil) pr.elemData = input[pos:] - assert(len(pr.elemData) == int(pr.elemEnds[len(pr.elemEnds)-1])) + assert(len(pr.elemData)-8 == int(pr.elemEnds[len(pr.elemEnds)-1])) return pr } @@ -67,6 +67,12 @@ func (pr *PkgDecoder) TotalElems() int { return len(pr.elemEnds) } +func (pr *PkgDecoder) Fingerprint() [8]byte { + var fp [8]byte + copy(fp[:], pr.elemData[len(pr.elemData)-8:]) + return fp +} + func (pr *PkgDecoder) AbsIdx(k RelocKind, idx int) int { absIdx := idx if k > 0 { |
