mirror of
https://github.com/opencontainers/runc.git
synced 2026-07-11 06:03:57 +08:00
Drop go 1.16
Require go 1.17 from now on, since go 1.16 is no longer supported. Drop go1.16 compatibility. NOTE we also have to install go 1.18 from Vagrantfile, because Fedora 35 comes with Go 1.16.x which can't be used. Note the changes to go.mod and vendor are due to https://go.dev/doc/go1.17#tools Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
This commit is contained in:
@@ -1,39 +0,0 @@
|
||||
//go:build !go1.17
|
||||
// +build !go1.17
|
||||
|
||||
package devices
|
||||
|
||||
import "io/fs"
|
||||
|
||||
// The following code is adapted from go1.17.1/src/io/fs/readdir.go
|
||||
// to compensate for the lack of fs.FileInfoToDirEntry in Go 1.16.
|
||||
|
||||
// dirInfo is a DirEntry based on a FileInfo.
|
||||
type dirInfo struct {
|
||||
fileInfo fs.FileInfo
|
||||
}
|
||||
|
||||
func (di dirInfo) IsDir() bool {
|
||||
return di.fileInfo.IsDir()
|
||||
}
|
||||
|
||||
func (di dirInfo) Type() fs.FileMode {
|
||||
return di.fileInfo.Mode().Type()
|
||||
}
|
||||
|
||||
func (di dirInfo) Info() (fs.FileInfo, error) {
|
||||
return di.fileInfo, nil
|
||||
}
|
||||
|
||||
func (di dirInfo) Name() string {
|
||||
return di.fileInfo.Name()
|
||||
}
|
||||
|
||||
// fileInfoToDirEntry returns a DirEntry that returns information from info.
|
||||
// If info is nil, FileInfoToDirEntry returns nil.
|
||||
func fileInfoToDirEntry(info fs.FileInfo) fs.DirEntry {
|
||||
if info == nil {
|
||||
return nil
|
||||
}
|
||||
return dirInfo{fileInfo: info}
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
//go:build go1.17
|
||||
// +build go1.17
|
||||
|
||||
package devices
|
||||
|
||||
import "io/fs"
|
||||
|
||||
var fileInfoToDirEntry = fs.FileInfoToDirEntry
|
||||
@@ -64,7 +64,7 @@ func TestHostDevicesIoutilReadDirDeepFailure(t *testing.T) {
|
||||
t.Fatalf("Unexpected error %v", err)
|
||||
}
|
||||
|
||||
return []fs.DirEntry{fileInfoToDirEntry(fi)}, nil
|
||||
return []fs.DirEntry{fs.FileInfoToDirEntry(fi)}, nil
|
||||
}
|
||||
defer cleanupTest()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user