Skip to content
This repository has been archived by the owner on Sep 6, 2022. It is now read-only.

stop using the deprecated io/ioutil package #279

Merged
merged 1 commit into from
Aug 17, 2022
Merged
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
14 changes: 7 additions & 7 deletions crypto/fixture_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"crypto/rand"
"fmt"
"io"
"io/ioutil"
"os"
"testing"

"github.com/libp2p/go-libp2p-core/crypto"
Expand Down Expand Up @@ -46,15 +46,15 @@ func fname(kt crypto_pb.KeyType, ext string) string {
func TestFixtures(t *testing.T) {
for _, tc := range keyTypes {
t.Run(tc.keyType.String(), func(t *testing.T) {
pubBytes, err := ioutil.ReadFile(fname(tc.keyType, "pub"))
pubBytes, err := os.ReadFile(fname(tc.keyType, "pub"))
if err != nil {
t.Fatal(err)
}
privBytes, err := ioutil.ReadFile(fname(tc.keyType, "priv"))
privBytes, err := os.ReadFile(fname(tc.keyType, "priv"))
if err != nil {
t.Fatal(err)
}
sigBytes, err := ioutil.ReadFile(fname(tc.keyType, "sig"))
sigBytes, err := os.ReadFile(fname(tc.keyType, "sig"))
if err != nil {
t.Fatal(err)
}
Expand Down Expand Up @@ -125,8 +125,8 @@ func generate() {
if err != nil {
panic(err)
}
ioutil.WriteFile(fname(tc.keyType, "pub"), pubb, 0666)
ioutil.WriteFile(fname(tc.keyType, "priv"), privb, 0666)
ioutil.WriteFile(fname(tc.keyType, "sig"), sig, 0666)
os.WriteFile(fname(tc.keyType, "pub"), pubb, 0666)
os.WriteFile(fname(tc.keyType, "priv"), privb, 0666)
os.WriteFile(fname(tc.keyType, "sig"), sig, 0666)
}
}