mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
303ea8e820
commit c55a4ac779
changed the ioutil utilities
to use the new os variants, per recommendation from the go 1.16 release notes:
https://golang.org/doc/go1.16#ioutil
> we encourage new code to use the new definitions in the io and os packages.
> Here is a list of the new locations of the names exported by io/ioutil:
However, the devil is in the detail, and io.ReadDir() is not a direct
replacement for ioutil.ReadDir();
> ReadDir => os.ReadDir (note: returns a slice of os.DirEntry rather than a slice of fs.FileInfo)
go1.16 added a io.FileInfoToDirEntry() utility to concert a DirEntry to
a FileInfo, but it's not available in go1.16
This patch copies the FileInfoToDirEntry code, and uses it for go1.16.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
8 lines
116 B
Go
8 lines
116 B
Go
//go:build go1.17
|
|
// +build go1.17
|
|
|
|
package plugins
|
|
|
|
import "io/fs"
|
|
|
|
var fileInfoToDirEntry = fs.FileInfoToDirEntry
|