Skip to content

Commit

Permalink
linting;
Browse files Browse the repository at this point in the history
  • Loading branch information
kmulvey committed Apr 9, 2024
1 parent 4a6a98b commit f3f0b47
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
7 changes: 5 additions & 2 deletions pkg/imagedup/logger/logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,10 @@ func NewDeleteLogger(filename string) (*DeleteLogger, error) {
}

// write the header
file.WriteString("[")
_, err = file.WriteString("[")
if err != nil {
return nil, fmt.Errorf("DeleteLogger could not write the leading [ to the file: %s, err: %w", filename, err)
}

return &DeleteLogger{FileName: filename, LogFile: file, FirstEntry: true}, nil
}
Expand All @@ -60,7 +63,7 @@ func ReadDeleteLogFile(filename string) ([]DeleteEntry, error) {
return entries, nil
}

// LogResult logs a single duplicate result as json. Each record is writted to disk immediatly as to not use too much RAM.
// LogResult logs a single duplicate result as json. Each record is writted to disk immediately as to not use too much RAM.
func (dl *DeleteLogger) LogResult(result hash.DiffResult) error {
var entry DeleteEntry

Expand Down
6 changes: 4 additions & 2 deletions pkg/imagedup/logger/logger_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,22 @@ func TestCustomLogger(t *testing.T) {
assert.NoError(t, err)

// one is bigger
logger.LogResult(hash.DiffResult{
err = logger.LogResult(hash.DiffResult{
One: "fileone",
Two: "filetwo",
OneArea: 20,
TwoArea: 10,
})
assert.NoError(t, err)

// two is bigger
logger.LogResult(hash.DiffResult{
err = logger.LogResult(hash.DiffResult{
One: "fileone",
Two: "filetwo",
OneArea: 10,
TwoArea: 20,
})
assert.NoError(t, err)
assert.NoError(t, logger.Close())

deletes, err := ReadDeleteLogFile(filename)
Expand Down

0 comments on commit f3f0b47

Please sign in to comment.