Skip to content

Commit

Permalink
Rename attachment reader variable
Browse files Browse the repository at this point in the history
  • Loading branch information
Wyatt Alt committed Nov 2, 2023
1 parent 0289aba commit a1ec07b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions go/cli/mcap/cmd/sort.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,12 @@ func sortFile(w io.Writer, r io.ReadSeeker) error {
return errUnindexedFile{err}
}

emptyFile, err := fileHasNoMessages(r)
isEmpty, err := fileHasNoMessages(r)
if err != nil {
return fmt.Errorf("failed to check if file is empty: %w", err)
}

if len(info.ChunkIndexes) == 0 && !emptyFile {
if len(info.ChunkIndexes) == 0 && !isEmpty {
return errUnindexedFile{errors.New("no chunk index records")}
}

Expand All @@ -93,7 +93,7 @@ func sortFile(w io.Writer, r io.ReadSeeker) error {
// handle the attachments and metadata metadata first; physical location in
// the file is irrelevant but order is preserved.
for _, index := range info.AttachmentIndexes {
ar, err := reader.GetAttachmentReader(index.Offset)
attReader, err := reader.GetAttachmentReader(index.Offset)
if err != nil {
return fmt.Errorf("failed to read attachment: %w", err)
}
Expand All @@ -103,7 +103,7 @@ func sortFile(w io.Writer, r io.ReadSeeker) error {
CreateTime: index.CreateTime,
LogTime: index.LogTime,
DataSize: index.DataSize,
Data: ar.Data(),
Data: attReader.Data(),
})
if err != nil {
return fmt.Errorf("failed to write attachment: %w", err)
Expand Down

0 comments on commit a1ec07b

Please sign in to comment.