Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate ioutil #14

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions bloomfilter.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (
"errors"
"fmt"
"io"
"io/ioutil"
"math"

"github.com/Workiva/go-datastructures/bitarray"
Expand Down Expand Up @@ -80,7 +79,7 @@ func FromBytes(b []byte) (*BloomFilter, error) {
numHashFunctions := int(numHashFuncByte)

// read bitarray capacity
numUint64Bytes, err := ioutil.ReadAll(io.LimitReader(reader, 4))
numUint64Bytes, err := io.ReadAll(io.LimitReader(reader, 4))
if err != nil {
return nil, fmt.Errorf("Failed to read number of bits: %v", err)
}
Expand All @@ -92,7 +91,7 @@ func FromBytes(b []byte) (*BloomFilter, error) {

// put blocks back to bitarray
for blockIdx := 0; blockIdx < int(numUint64); blockIdx++ {
block, err := ioutil.ReadAll(io.LimitReader(reader, 8))
block, err := io.ReadAll(io.LimitReader(reader, 8))
if err != nil {
return nil, fmt.Errorf("Failed to build bitarray: %v", err)
}
Expand Down
8 changes: 4 additions & 4 deletions bloomfilter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import (
"bytes"
"io/ioutil"
"io"
"os"
"testing"
)
Expand Down Expand Up @@ -136,7 +136,7 @@
func TestJavaCompatibility(t *testing.T) {
file1, _ := os.Open("guava_dump_files/100_0_001_0_to_49_test.dump")
defer file1.Close()
b, _ := ioutil.ReadAll(file1)
b, _ := io.ReadAll(file1)

Check failure on line 139 in bloomfilter_test.go

View workflow job for this annotation

GitHub Actions / build (1.13)

undefined: io.ReadAll

Check failure on line 139 in bloomfilter_test.go

View workflow job for this annotation

GitHub Actions / build (1.15)

undefined: io.ReadAll
bf1, err := FromBytes(b)
if err != nil {
t.Errorf("Deserialization from Guava dump file failed: %v", err)
Expand All @@ -154,7 +154,7 @@

file2, _ := os.Open("guava_dump_files/500_0_01_0_to_99_test.dump")
defer file1.Close()
b, _ = ioutil.ReadAll(file2)
b, _ = io.ReadAll(file2)

Check failure on line 157 in bloomfilter_test.go

View workflow job for this annotation

GitHub Actions / build (1.13)

undefined: io.ReadAll

Check failure on line 157 in bloomfilter_test.go

View workflow job for this annotation

GitHub Actions / build (1.15)

undefined: io.ReadAll
bf2, err := FromBytes(b)
if err != nil {
t.Errorf("Deserialization from Guava dump file failed: %v", err)
Expand Down Expand Up @@ -223,7 +223,7 @@
}
}

var fileContent, _ = ioutil.ReadFile("guava_dump_files/100_0_001_0_to_49_test.dump")
var fileContent, _ = os.ReadFile("guava_dump_files/100_0_001_0_to_49_test.dump")

Check failure on line 226 in bloomfilter_test.go

View workflow job for this annotation

GitHub Actions / build (1.13)

undefined: os.ReadFile

Check failure on line 226 in bloomfilter_test.go

View workflow job for this annotation

GitHub Actions / build (1.15)

undefined: os.ReadFile

func BenchmarkBloomfilterDeserialization(b *testing.B) {
for i := 0; i < b.N; i++ {
Expand Down
Loading