|
@@ -21,7 +21,7 @@ import (
|
|
|
"errors"
|
|
|
"flag"
|
|
|
"fmt"
|
|
|
- "io/ioutil"
|
|
|
+ "io"
|
|
|
stdLog "log"
|
|
|
"os"
|
|
|
"path/filepath"
|
|
@@ -383,7 +383,7 @@ func TestSetOutputDataRace(t *testing.T) {
|
|
|
wg.Add(1)
|
|
|
go func() {
|
|
|
defer wg.Done()
|
|
|
- SetOutput(ioutil.Discard)
|
|
|
+ SetOutput(io.Discard)
|
|
|
}()
|
|
|
}
|
|
|
for i := 1; i <= 50; i++ {
|
|
@@ -395,7 +395,7 @@ func TestSetOutputDataRace(t *testing.T) {
|
|
|
wg.Add(1)
|
|
|
go func() {
|
|
|
defer wg.Done()
|
|
|
- SetOutputBySeverity("INFO", ioutil.Discard)
|
|
|
+ SetOutputBySeverity("INFO", io.Discard)
|
|
|
}()
|
|
|
}
|
|
|
for i := 1; i <= 50; i++ {
|
|
@@ -514,7 +514,7 @@ func TestOpenAppendOnStart(t *testing.T) {
|
|
|
err = e
|
|
|
}
|
|
|
|
|
|
- f, err := ioutil.TempFile("", "test_klog_OpenAppendOnStart")
|
|
|
+ f, err := os.CreateTemp("", "test_klog_OpenAppendOnStart")
|
|
|
if err != nil {
|
|
|
t.Fatalf("unexpected error: %v", err)
|
|
|
}
|
|
@@ -535,7 +535,7 @@ func TestOpenAppendOnStart(t *testing.T) {
|
|
|
|
|
|
// ensure we wrote what we expected
|
|
|
logging.flushAll()
|
|
|
- b, err := ioutil.ReadFile(logging.logFile)
|
|
|
+ b, err := os.ReadFile(logging.logFile)
|
|
|
if err != nil {
|
|
|
t.Fatalf("unexpected error: %v", err)
|
|
|
}
|
|
@@ -552,7 +552,7 @@ func TestOpenAppendOnStart(t *testing.T) {
|
|
|
Info(y)
|
|
|
// ensure we wrote what we expected
|
|
|
logging.lockAndFlushAll()
|
|
|
- b, err = ioutil.ReadFile(logging.logFile)
|
|
|
+ b, err = os.ReadFile(logging.logFile)
|
|
|
if err != nil {
|
|
|
t.Fatalf("unexpected error: %v", err)
|
|
|
}
|
|
@@ -561,7 +561,7 @@ func TestOpenAppendOnStart(t *testing.T) {
|
|
|
}
|
|
|
// The initial log message should be preserved across create calls.
|
|
|
logging.lockAndFlushAll()
|
|
|
- b, err = ioutil.ReadFile(logging.logFile)
|
|
|
+ b, err = os.ReadFile(logging.logFile)
|
|
|
if err != nil {
|
|
|
t.Fatalf("unexpected error: %v", err)
|
|
|
}
|
|
@@ -645,7 +645,7 @@ func BenchmarkLogs(b *testing.B) {
|
|
|
setFlags()
|
|
|
defer logging.swap(logging.newBuffers())
|
|
|
|
|
|
- testFile, err := ioutil.TempFile("", "test.log")
|
|
|
+ testFile, err := os.CreateTemp("", "test.log")
|
|
|
if err != nil {
|
|
|
b.Fatal("unable to create temporary file")
|
|
|
}
|