diff options
author | Russ Cox <rsc@golang.org> | 2020-07-07 13:49:21 -0400 |
---|---|---|
committer | Russ Cox <rsc@golang.org> | 2020-10-20 02:32:42 +0000 |
commit | 7bb721b9384bdd196befeaed593b185f7f2a5589 (patch) | |
tree | 882f21fc2e1fbba6fb11100e4fd8efc5f973a44d /src/crypto | |
parent | d4da735091986868015369e01c63794af9cc9b84 (diff) | |
download | go-7bb721b9384bdd196befeaed593b185f7f2a5589.tar.gz go-7bb721b9384bdd196befeaed593b185f7f2a5589.zip |
all: update references to symbols moved from os to io/fs
The old os references are still valid, but update our code
to reflect best practices and get used to the new locations.
Code compiled with the bootstrap toolchain
(cmd/asm, cmd/dist, cmd/compile, debug/elf)
must remain Go 1.4-compatible and is excluded.
For #41190.
Change-Id: I8f9526977867c10a221e2f392f78d7dec073f1bd
Reviewed-on: https://go-review.googlesource.com/c/go/+/243907
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
Diffstat (limited to 'src/crypto')
-rw-r--r-- | src/crypto/rand/eagain.go | 4 | ||||
-rw-r--r-- | src/crypto/x509/root_unix.go | 7 |
2 files changed, 6 insertions, 5 deletions
diff --git a/src/crypto/rand/eagain.go b/src/crypto/rand/eagain.go index f251ba28fc..c9499715dc 100644 --- a/src/crypto/rand/eagain.go +++ b/src/crypto/rand/eagain.go @@ -7,7 +7,7 @@ package rand import ( - "os" + "io/fs" "syscall" ) @@ -18,7 +18,7 @@ func init() { // unixIsEAGAIN reports whether err is a syscall.EAGAIN wrapped in a PathError. // See golang.org/issue/9205 func unixIsEAGAIN(err error) bool { - if pe, ok := err.(*os.PathError); ok { + if pe, ok := err.(*fs.PathError); ok { if errno, ok := pe.Err.(syscall.Errno); ok && errno == syscall.EAGAIN { return true } diff --git a/src/crypto/x509/root_unix.go b/src/crypto/x509/root_unix.go index 2aa38751f3..ae72f025c3 100644 --- a/src/crypto/x509/root_unix.go +++ b/src/crypto/x509/root_unix.go @@ -7,6 +7,7 @@ package x509 import ( + "io/fs" "io/ioutil" "os" "path/filepath" @@ -83,7 +84,7 @@ func loadSystemRoots() (*CertPool, error) { // readUniqueDirectoryEntries is like ioutil.ReadDir but omits // symlinks that point within the directory. -func readUniqueDirectoryEntries(dir string) ([]os.FileInfo, error) { +func readUniqueDirectoryEntries(dir string) ([]fs.FileInfo, error) { fis, err := ioutil.ReadDir(dir) if err != nil { return nil, err @@ -99,8 +100,8 @@ func readUniqueDirectoryEntries(dir string) ([]os.FileInfo, error) { // isSameDirSymlink reports whether fi in dir is a symlink with a // target not containing a slash. -func isSameDirSymlink(fi os.FileInfo, dir string) bool { - if fi.Mode()&os.ModeSymlink == 0 { +func isSameDirSymlink(fi fs.FileInfo, dir string) bool { + if fi.Mode()&fs.ModeSymlink == 0 { return false } target, err := os.Readlink(filepath.Join(dir, fi.Name())) |