Skip to content
Open
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
6 changes: 3 additions & 3 deletions config_dbtester.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ package dbtester

import (
"fmt"
"io/ioutil"
"os"
"path/filepath"
"strings"

Expand Down Expand Up @@ -57,7 +57,7 @@ type Config struct {

// ReadConfig reads control configuration file.
func ReadConfig(fpath string, analyze bool) (*Config, error) {
bts, err := ioutil.ReadFile(fpath)
bts, err := os.ReadFile(fpath)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -279,7 +279,7 @@ func ReadConfig(fpath string, analyze bool) (*Config, error) {
}

if cfg.ConfigClientMachineInitial.GoogleCloudStorageKeyPath != "" && !analyze {
bts, err = ioutil.ReadFile(cfg.ConfigClientMachineInitial.GoogleCloudStorageKeyPath)
bts, err = os.ReadFile(cfg.ConfigClientMachineInitial.GoogleCloudStorageKeyPath)
if err != nil {
return nil, err
}
Expand Down
3 changes: 1 addition & 2 deletions pkg/fileinspect/fileinspect_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ package fileinspect
import (
"bytes"
"fmt"
"io/ioutil"
"os"
"path/filepath"
"testing"
Expand Down Expand Up @@ -45,7 +44,7 @@ func writeData(fpath string, data []byte) (n int, err error) {
}

func createData() (dir string, n int64, err error) {
dir, err = ioutil.TempDir(os.TempDir(), "fileinspect-write-test")
dir, err = os.MkdirTemp(os.TempDir(), "fileinspect-write-test")
if err != nil {
return
}
Expand Down
6 changes: 3 additions & 3 deletions pkg/remotestorage/example/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,16 @@
package main

import (
"io/ioutil"
"log"
"os"

"github.com/etcd-io/dbtester/pkg/remotestorage"

"go.uber.org/zap"
)

func main() {
kbs, err := ioutil.ReadFile("key.json")
kbs, err := os.ReadFile("key.json")
if err != nil {
log.Fatal(err)
}
Expand All @@ -37,7 +37,7 @@ func main() {
}

// upload directories
// kbs, err := ioutil.ReadFile("key.json")
// kbs, err := os.ReadFile("key.json")
// if err != nil {
// log.Fatal(err)
// }
Expand Down
10 changes: 5 additions & 5 deletions pkg/remotestorage/uploader.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ package remotestorage
import (
"context"
"fmt"
"io/ioutil"
"os"
"path/filepath"
"strings"

Expand Down Expand Up @@ -91,9 +91,9 @@ func (g *GoogleCloudStorage) UploadFile(bucket, src, dst string, opts ...OpOptio
}

g.lg.Info("uploading", zap.String("source", src), zap.String("destination", dst))
bts, err := ioutil.ReadFile(src)
bts, err := os.ReadFile(src)
if err != nil {
return fmt.Errorf("ioutil.ReadFile(%s) %v", src, err)
return fmt.Errorf("os.ReadFile(%s) %v", src, err)
}
if _, err := wc.Write(bts); err != nil {
return err
Expand Down Expand Up @@ -144,9 +144,9 @@ func (g *GoogleCloudStorage) UploadDir(bucket, src, dst string, opts ...OpOption
if ret.ContentType != "" {
wc.ContentType = ret.ContentType
}
bts, err := ioutil.ReadFile(fpath)
bts, err := os.ReadFile(fpath)
if err != nil {
errc <- fmt.Errorf("ioutil.ReadFile(%s) %v", fpath, err)
errc <- fmt.Errorf("os.ReadFile(%s) %v", fpath, err)
return
}
if _, err := wc.Write(bts); err != nil {
Expand Down
3 changes: 1 addition & 2 deletions util.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ package dbtester
import (
"fmt"
"io"
"io/ioutil"
mrand "math/rand"
"net/http"
"os"
Expand Down Expand Up @@ -90,7 +89,7 @@ func exist(fpath string) bool {
// and closes it. This prevents TCP/TLS connections from closing,
// therefore available for reuse.
func gracefulClose(resp *http.Response) {
io.Copy(ioutil.Discard, resp.Body)
io.Copy(io.Discard, resp.Body)
resp.Body.Close()
}

Expand Down