Skip to content

Commit

Permalink
io/ioutil package is deprecated
Browse files Browse the repository at this point in the history
  • Loading branch information
furusax0621 authored and xiantang committed Dec 5, 2021
1 parent cae70ac commit e662a05
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 6 deletions.
3 changes: 1 addition & 2 deletions runner/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package runner

import (
"fmt"
"io/ioutil"
"log"
"os"
"path/filepath"
Expand Down Expand Up @@ -209,7 +208,7 @@ func defaultConfig() config {
}

func readConfig(path string) (*config, error) {
data, err := ioutil.ReadFile(path)
data, err := os.ReadFile(path)
if err != nil {
return nil, err
}
Expand Down
3 changes: 1 addition & 2 deletions runner/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"crypto/sha256"
"encoding/hex"
"errors"
"io/ioutil"
"os"
"path/filepath"
"runtime"
Expand Down Expand Up @@ -229,7 +228,7 @@ func adaptToVariousPlatforms(c *config) {

// fileChecksum returns a checksum for the given file's contents.
func fileChecksum(filename string) (checksum string, err error) {
contents, err := ioutil.ReadFile(filename)
contents, err := os.ReadFile(filename)
if err != nil {
return "", err
}
Expand Down
3 changes: 1 addition & 2 deletions runner/util_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package runner

import (
"io/ioutil"
"os"
"testing"
)
Expand Down Expand Up @@ -74,7 +73,7 @@ func TestFileChecksum(t *testing.T) {

for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
f, err := ioutil.TempFile("", "")
f, err := os.CreateTemp("", "")
if err != nil {
t.Fatalf("couldn't create temp file for test: %v", err)
}
Expand Down

0 comments on commit e662a05

Please sign in to comment.