Fix noinlineerr findings: internal/vaultik (refs #61)

This commit is contained in:
2026-08-07 16:59:56 +00:00
parent 919229f224
commit e7b49d58ab
10 changed files with 123 additions and 56 deletions

View File

@@ -90,7 +90,8 @@ func (v *Vaultik) RunDeepVerify(snapshotID string, opts *VerifyOptions) error {
result.TotalSize = totalSize
if err := v.runVerificationSteps(manifest, dbBlobs, tempDB, opts, result, totalSize); err != nil {
err = v.runVerificationSteps(manifest, dbBlobs, tempDB, opts, result, totalSize)
if err != nil {
return err
}
@@ -337,7 +338,8 @@ func (v *Vaultik) verifyBlob(blobInfo snapshot.BlobInfo, db *sql.DB) error {
return err
}
if err := v.verifyBlobFinalIntegrity(decompressor, blobHasher, blobInfo.Hash); err != nil {
err = v.verifyBlobFinalIntegrity(decompressor, blobHasher, blobInfo.Hash)
if err != nil {
return err
}
@@ -396,7 +398,9 @@ func (v *Vaultik) verifyBlobChunks(db *sql.DB, blobHash string, decompressor io.
if offset > totalRead {
// Skip to the correct offset
skipBytes := offset - totalRead
if _, err := io.CopyN(io.Discard, decompressor, skipBytes); err != nil {
_, err = io.CopyN(io.Discard, decompressor, skipBytes)
if err != nil {
return 0, fmt.Errorf("failed to skip to offset %d: %w", offset, err)
}
@@ -405,7 +409,9 @@ func (v *Vaultik) verifyBlobChunks(db *sql.DB, blobHash string, decompressor io.
// Read chunk data
chunkData := make([]byte, length)
if _, err := io.ReadFull(decompressor, chunkData); err != nil {
_, err = io.ReadFull(decompressor, chunkData)
if err != nil {
return 0, fmt.Errorf("failed to read chunk at offset %d: %w", offset, err)
}
@@ -424,7 +430,8 @@ func (v *Vaultik) verifyBlobChunks(db *sql.DB, blobHash string, decompressor io.
chunkCount++
}
if err := rows.Err(); err != nil {
err = rows.Err()
if err != nil {
return 0, fmt.Errorf("error iterating blob chunks: %w", err)
}
@@ -490,7 +497,8 @@ func (v *Vaultik) getBlobsFromDatabase(snapshotID string, db *sql.DB) ([]snapsho
})
}
if err := rows.Err(); err != nil {
err = rows.Err()
if err != nil {
return nil, fmt.Errorf("error iterating blobs: %w", err)
}