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

chore: remove refs to deprecated io/ioutil #438

Merged
merged 1 commit into from
Oct 23, 2023
Merged
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
4 changes: 2 additions & 2 deletions examples/3-messaging/service/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"context"
"encoding/json"
"fmt"
"io/ioutil"
"io"
"log"
"net/http"

Expand Down Expand Up @@ -39,7 +39,7 @@ func send(emitter *goka.Emitter, stream goka.Stream) func(w http.ResponseWriter,
return func(w http.ResponseWriter, r *http.Request) {
var m messaging.Message

b, err := ioutil.ReadAll(r.Body)
b, err := io.ReadAll(r.Body)
if err != nil {
fmt.Fprintf(w, "error: %v", err)
return
Expand Down
4 changes: 2 additions & 2 deletions examples/7-redis/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import (
"context"
"flag"
"fmt"
"io/ioutil"
"log"
"math/rand"
"os"
"strconv"
"time"

Expand Down Expand Up @@ -61,7 +61,7 @@ func main() {
}

func readConfig(filename string) (*Config, error) {
b, err := ioutil.ReadFile(filename)
b, err := os.ReadFile(filename)
if err != nil {
return nil, err
}
Expand Down
4 changes: 2 additions & 2 deletions iterator_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package goka

import (
"io/ioutil"
"os"
"testing"

"github.com/lovoo/goka/codec"
Expand All @@ -11,7 +11,7 @@ import (
)

func TestIterator(t *testing.T) {
tmpdir, err := ioutil.TempDir("", "goka_storage_TestIterator")
tmpdir, err := os.MkdirTemp("", "goka_storage_TestIterator")
require.NoError(t, err)

db, err := leveldb.OpenFile(tmpdir, nil)
Expand Down
4 changes: 2 additions & 2 deletions storage/iterator_test.go
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package storage

import (
"io/ioutil"
"os"
"testing"

"github.com/syndtr/goleveldb/leveldb"
)

func TestIterator(t *testing.T) {
tmpdir, err := ioutil.TempDir("", "goka_storage_TestIterator")
tmpdir, err := os.MkdirTemp("", "goka_storage_TestIterator")
assertNil(t, err)

db, err := leveldb.OpenFile(tmpdir, nil)
Expand Down
6 changes: 3 additions & 3 deletions storage/leveldb_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package storage

import (
"fmt"
"io/ioutil"
"os"
"testing"

"github.com/stretchr/testify/require"
Expand All @@ -22,7 +22,7 @@ func init() {
}

func BenchmarkStateStorage_unbatched(b *testing.B) {
tmpdir, err := ioutil.TempDir("", "benchmark_statestorage_unbatched")
tmpdir, err := os.MkdirTemp("", "benchmark_statestorage_unbatched")
require.NoError(b, err)

db, err := leveldb.OpenFile(tmpdir, nil)
Expand All @@ -39,7 +39,7 @@ func BenchmarkStateStorage_unbatched(b *testing.B) {
}

func BenchmarkStateStorage_transactioned(b *testing.B) {
tmpdir, err := ioutil.TempDir("", "benchmark_statestorage_transactioned")
tmpdir, err := os.MkdirTemp("", "benchmark_statestorage_transactioned")
require.NoError(b, err)

db, err := leveldb.OpenFile(tmpdir, nil)
Expand Down
3 changes: 1 addition & 2 deletions storage/merge_iterator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package storage
import (
"bytes"
"fmt"
"io/ioutil"
"os"
"testing"

Expand All @@ -18,7 +17,7 @@ type TeardownFunc func(*testing.T)
func TempDir(t *testing.T) (string, TeardownFunc) {
t.Helper()

path, err := ioutil.TempDir(os.TempDir(), "goka_test_")
path, err := os.MkdirTemp(os.TempDir(), "goka_test_")
if err != nil {
t.Fatalf("error creating temporary directory: %v", err)
}
Expand Down