diff --git a/examples/3-messaging/service/service.go b/examples/3-messaging/service/service.go index 9b042383..68ef1fea 100644 --- a/examples/3-messaging/service/service.go +++ b/examples/3-messaging/service/service.go @@ -4,7 +4,7 @@ import ( "context" "encoding/json" "fmt" - "io/ioutil" + "io" "log" "net/http" @@ -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 diff --git a/examples/7-redis/main.go b/examples/7-redis/main.go index 5a218c55..0f74c4c7 100644 --- a/examples/7-redis/main.go +++ b/examples/7-redis/main.go @@ -4,9 +4,9 @@ import ( "context" "flag" "fmt" - "io/ioutil" "log" "math/rand" + "os" "strconv" "time" @@ -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 } diff --git a/iterator_test.go b/iterator_test.go index 23fe4e6e..ea94a652 100644 --- a/iterator_test.go +++ b/iterator_test.go @@ -1,7 +1,7 @@ package goka import ( - "io/ioutil" + "os" "testing" "github.com/lovoo/goka/codec" @@ -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) diff --git a/storage/iterator_test.go b/storage/iterator_test.go index dc5180b0..73e85fcd 100644 --- a/storage/iterator_test.go +++ b/storage/iterator_test.go @@ -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) diff --git a/storage/leveldb_test.go b/storage/leveldb_test.go index 709e1219..7f895f73 100644 --- a/storage/leveldb_test.go +++ b/storage/leveldb_test.go @@ -2,7 +2,7 @@ package storage import ( "fmt" - "io/ioutil" + "os" "testing" "github.com/stretchr/testify/require" @@ -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) @@ -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) diff --git a/storage/merge_iterator_test.go b/storage/merge_iterator_test.go index 9ed703a2..48bf0ada 100644 --- a/storage/merge_iterator_test.go +++ b/storage/merge_iterator_test.go @@ -3,7 +3,6 @@ package storage import ( "bytes" "fmt" - "io/ioutil" "os" "testing" @@ -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) }