Skip to content

Commit

Permalink
fix: linting issues
Browse files Browse the repository at this point in the history
  • Loading branch information
nugaon committed Nov 8, 2023
1 parent 5bb42e0 commit 73cdcf9
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pkg/file/pipeline/hashtrie/hashtrie.go
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ func (h *hashTrieWriter) Sum() ([]byte, error) {
if err != nil {
return nil, err
}
// update counters, substracting from current level is not necessary
// update counters, subtracting from current level is not necessary
h.effectiveChunkCounters[i+1]++
h.chunkCounters[i+1]++
default:
Expand Down
5 changes: 4 additions & 1 deletion pkg/file/redundancy/redundancy.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,10 @@ func (p *Params) encode(chunkLevel int, callback ParityChunkCallback) error {
for i := shards; i < n; i++ {
p.buffer[chunkLevel][i] = make([]byte, pz)
}
enc.Encode(p.buffer[chunkLevel][:n])
err = enc.Encode(p.buffer[chunkLevel][:n])
if err != nil {
return err
}
// store and pass newly created parity chunks
for i := shards; i < n; i++ {
chunkData := p.buffer[chunkLevel][i]
Expand Down
15 changes: 12 additions & 3 deletions pkg/file/redundancy/redundancy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,12 +115,21 @@ func TestEncode(t *testing.T) {

for i := 0; i < shardCount; i++ {
buffer := make([]byte, 32)
io.ReadFull(rand.Reader, buffer)
params.ChunkWrite(0, buffer, parityCallback)
_, err := io.ReadFull(rand.Reader, buffer)
if err != nil {
t.Error(err)
}
err = params.ChunkWrite(0, buffer, parityCallback)
if err != nil {
t.Error(err)
}
}
if shardCount != maxShards {
// encode should be called automatically when reaching maxshards
params.Encode(0, parityCallback)
err := params.Encode(0, parityCallback)
if err != nil {
t.Error(err)
}
}

// CHECKS
Expand Down

0 comments on commit 73cdcf9

Please sign in to comment.