refactor: move from io/ioutil to io and os packages (#1417)

The io/ioutil package has been deprecated as of Go 1.16 [1]. This commit
replaces the existing io/ioutil functions with their new definitions in
io and os packages.

[1]: https://golang.org/doc/go1.16#ioutil
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
This commit is contained in:
Eng Zer Jun
2022-10-30 01:15:38 +08:00
committed by GitHub
parent a73d5063d8
commit 2f1c5a19f1
7 changed files with 25 additions and 30 deletions

View File

@@ -3,7 +3,6 @@ package git
import (
"context"
"fmt"
"io/ioutil"
"os"
"os/exec"
"path/filepath"
@@ -45,7 +44,7 @@ func TestFindGitSlug(t *testing.T) {
}
func testDir(t *testing.T) string {
basedir, err := ioutil.TempDir("", "act-test")
basedir, err := os.MkdirTemp("", "act-test")
require.NoError(t, err)
t.Cleanup(func() { _ = os.RemoveAll(basedir) })
return basedir
@@ -53,7 +52,7 @@ func testDir(t *testing.T) string {
func cleanGitHooks(dir string) error {
hooksDir := filepath.Join(dir, ".git", "hooks")
files, err := ioutil.ReadDir(hooksDir)
files, err := os.ReadDir(hooksDir)
if err != nil {
if os.IsNotExist(err) {
return nil