Skip to content

Commit

Permalink
*: move from io/ioutil to io and os packages
Browse files Browse the repository at this point in the history
The io/ioutil package has been deprecated as of Go 1.16, see
https://golang.org/doc/go1.16#ioutil. This commit replaces the existing
io/ioutil functions with their new definitions in io and os packages.

Signed-off-by: Eng Zer Jun <[email protected]>
  • Loading branch information
Juneezee committed Oct 27, 2021
1 parent 6f50475 commit 6668cc5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
3 changes: 1 addition & 2 deletions diff_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ package raft
import (
"fmt"
"io"
"io/ioutil"
"os"
"os/exec"
"strings"
Expand All @@ -43,7 +42,7 @@ func diffu(a, b string) string {
}

func mustTemp(pre, body string) string {
f, err := ioutil.TempFile("", pre)
f, err := os.CreateTemp("", pre)
if err != nil {
panic(err)
}
Expand Down
4 changes: 2 additions & 2 deletions logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ package raft

import (
"fmt"
"io/ioutil"
"io"
"log"
"os"
"sync"
Expand Down Expand Up @@ -60,7 +60,7 @@ func getLogger() Logger {

var (
defaultLogger = &DefaultLogger{Logger: log.New(os.Stderr, "raft", log.LstdFlags)}
discardLogger = &DefaultLogger{Logger: log.New(ioutil.Discard, "", 0)}
discardLogger = &DefaultLogger{Logger: log.New(io.Discard, "", 0)}
raftLoggerMu sync.Mutex
raftLogger = Logger(defaultLogger)
)
Expand Down

0 comments on commit 6668cc5

Please sign in to comment.