A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/orgrim/pg_back/commit/c634027951fdd30c9accd3fe1fc53156eb0d0f6c below:

Remove deprecated usage of ioutils · orgrim/pg_back@c634027 · GitHub

File tree Expand file treeCollapse file tree 4 files changed

+9

-11

lines changed

Filter options

Expand file treeCollapse file tree 4 files changed

+9

-11

lines changed Original file line number Diff line number Diff line change

@@ -28,7 +28,7 @@ package main

28 28

import (

29 29

"errors"

30 30

"fmt"

31 -

"io/ioutil"

31 +

"io"

32 32

"os"

33 33

"os/exec"

34 34

"path/filepath"

@@ -50,7 +50,7 @@ func TestChecksumFile(t *testing.T) {

50 50 51 51

// create a temporary directory to store a test file to

52 52

// checksum with the different algorithm relatively

53 -

dir, err := ioutil.TempDir("", "test_checksum_file")

53 +

dir, err := os.MkdirTemp("", "test_checksum_file")

54 54

if err != nil {

55 55

t.Fatal("could not create tempdir:", err)

56 56

}

@@ -110,7 +110,7 @@ func TestChecksumFile(t *testing.T) {

110 110 111 111

// bad files

112 112

var e *os.PathError

113 -

l.logger.SetOutput(ioutil.Discard)

113 +

l.logger.SetOutput(io.Discard)

114 114

if _, err := checksumFile("", 0o700, "sha1"); !errors.As(err, &e) {

115 115

t.Errorf("expected an *os.PathError, got %q\n", err)

116 116

}

Original file line number Diff line number Diff line change

@@ -39,7 +39,7 @@ import (

39 39

func readLegacyConf(f io.Reader) ([]string, error) {

40 40

var lines []string

41 41 42 -

data, err := ioutil.ReadAll(f)

42 +

data, err := io.ReadAll(f)

43 43

if err != nil {

44 44

return lines, fmt.Errorf("could not read file: %w", err)

45 45

}

Original file line number Diff line number Diff line change

@@ -27,7 +27,6 @@ package main

27 27 28 28

import (

29 29

"errors"

30 -

"io/ioutil"

31 30

"os"

32 31

"path/filepath"

33 32

"runtime"

@@ -36,7 +35,7 @@ import (

36 35 37 36

func TestLockPath(t *testing.T) {

38 37

// Work from a tempdir

39 -

dir, err := ioutil.TempDir("", "test_lockpath")

38 +

dir, err := os.MkdirTemp("", "test_lockpath")

40 39

if err != nil {

41 40

t.Fatal("could not create tempdir:", err)

42 41

}

@@ -83,7 +82,7 @@ func TestLockPath(t *testing.T) {

83 82

}

84 83 85 84

func TestUnlockPath(t *testing.T) {

86 -

f, err := ioutil.TempFile("", "test_unlockpath")

85 +

f, err := os.CreateTemp("", "test_unlockpath")

87 86

if err != nil {

88 87

t.Fatal("could not create tempfile")

89 88

}

Original file line number Diff line number Diff line change

@@ -27,7 +27,6 @@ package main

27 27 28 28

import (

29 29

"fmt"

30 -

"io/ioutil"

31 30

"os"

32 31

"path/filepath"

33 32

"runtime"

@@ -38,7 +37,7 @@ import (

38 37

// func purgeDumps(directory string, dbname string, keep int, limit time.Time) error

39 38

func TestPurgeDumps(t *testing.T) {

40 39

// work in a tempdir

41 -

dir, err := ioutil.TempDir("", "test_purge_dumps")

40 +

dir, err := os.MkdirTemp("", "test_purge_dumps")

42 41

if err != nil {

43 42

t.Fatal("could not create tempdir:", err)

44 43

}

@@ -81,7 +80,7 @@ func TestPurgeDumps(t *testing.T) {

81 80

// file without write perms

82 81

if runtime.GOOS != "windows" {

83 82

tf = formatDumpPath(wd, time.RFC3339, "dump", "db", time.Now().Add(-time.Hour), 0)

84 -

ioutil.WriteFile(tf, []byte("truc\n"), 0644)

83 +

os.WriteFile(tf, []byte("truc\n"), 0644)

85 84

os.Chmod(filepath.Dir(tf), 0555)

86 85 87 86

err = purgeDumps(wd, "db", 0, time.Now())

@@ -139,7 +138,7 @@ func TestPurgeDumps(t *testing.T) {

139 138

for i := 1; i <= 3; i++ {

140 139

when := time.Now().Add(-time.Hour * time.Duration(i))

141 140

tf = formatDumpPath(wd, st.format, "dump", "db", when, 0)

142 -

ioutil.WriteFile(tf, []byte("truc\n"), 0644)

141 +

os.WriteFile(tf, []byte("truc\n"), 0644)

143 142

os.Chtimes(tf, when, when)

144 143

}

145 144

You can’t perform that action at this time.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4