From f1980efb92c011eab71aa61b68ccf58d845d1de7 Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Thu, 29 Oct 2020 14:46:29 -0400 Subject: all: update to use os.ReadDir where appropriate os.ReadDir is a replacement for ioutil.ReadDir that returns a slice of fs.DirEntry instead of fs.FileInfo, meaning it is the more efficient form. This CL updates call sites throughout the Go source tree wherever possible. As usual, code built using the Go 1.4 bootstrap toolchain is not included. There is also a use in go/build that appears in the public API and can't be changed, at least not without additional changes. Fixes #42026. Change-Id: Icfc9dd52c6045020f6830e22c72128499462d561 Reviewed-on: https://go-review.googlesource.com/c/go/+/266366 Trust: Russ Cox Run-TryBot: Russ Cox TryBot-Result: Go Bot Reviewed-by: Ian Lance Taylor --- src/os/exec/exec_test.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/os/exec/exec_test.go') diff --git a/src/os/exec/exec_test.go b/src/os/exec/exec_test.go index 92429f63a5..8b0c93f382 100644 --- a/src/os/exec/exec_test.go +++ b/src/os/exec/exec_test.go @@ -15,7 +15,6 @@ import ( "internal/poll" "internal/testenv" "io" - "io/ioutil" "log" "net" "net/http" @@ -386,7 +385,7 @@ func TestPipeLookPathLeak(t *testing.T) { // Reading /proc/self/fd is more reliable than calling lsof, so try that // first. numOpenFDs := func() (int, []byte, error) { - fds, err := ioutil.ReadDir("/proc/self/fd") + fds, err := os.ReadDir("/proc/self/fd") if err != nil { return 0, nil, err } -- cgit v1.3