Skip to content

Commit

Permalink
Additional fixes for the ChunkIDs print (#279)
Browse files Browse the repository at this point in the history
Add `.String()` every time we try to print a chunk ID.

Signed-off-by: Ludovico de Nittis <[email protected]>
  • Loading branch information
RyuzakiKK authored Feb 1, 2025
1 parent ec051c6 commit b4b3981
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions assemble.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func writeChunk(c IndexChunk, ss *selfSeed, f *os.File, blocksize uint64, s Stor
}
// Might as well verify the chunk size while we're at it
if c.Size != uint64(len(b)) {
return fmt.Errorf("unexpected size for chunk %s", c.ID)
return fmt.Errorf("unexpected size for chunk %s", c.ID.String())
}
// Write the decompressed chunk into the file at the right position
if _, err = f.WriteAt(b, int64(c.Start)); err != nil {
Expand Down Expand Up @@ -190,7 +190,7 @@ func AssembleFile(ctx context.Context, name string, idx Index, s Store, seeds []
if sum != c.ID {
if options.InvalidSeedAction == InvalidSeedActionRegenerate {
// Try harder before giving up and aborting
Log.WithField("ID", c.ID).Info("The seed may have changed during processing, trying to take the chunk from the self seed or the store")
Log.WithField("ID", c.ID.String()).Info("The seed may have changed during processing, trying to take the chunk from the self seed or the store")
if err := writeChunk(c, ss, f, blocksize, s, stats, isBlank); err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ type NoSuchObject struct {
}

func (e ChunkMissing) Error() string {
return fmt.Sprintf("chunk %s missing from store", e.ID)
return fmt.Sprintf("chunk %s missing from store", e.ID.String())
}

func (e NoSuchObject) Error() string {
Expand Down
2 changes: 1 addition & 1 deletion untar.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ func UnTarIndex(ctx context.Context, fs FilesystemWriter, index Index, s Store,
// Might as well verify the chunk size while we're at it
if r.chunk.Size != uint64(len(b)) {
close(r.data)
return fmt.Errorf("unexpected size for chunk %s", r.chunk.ID)
return fmt.Errorf("unexpected size for chunk %s", r.chunk.ID.String())
}
r.data <- b
close(r.data)
Expand Down

0 comments on commit b4b3981

Please sign in to comment.