The 1.16 `io/fs` compatibility code was being built on 1.18 and 1.19.
Drop it completely as 1.16 is long EOL, and additionally drop 1.17 as it
has been EOL for a month and 1.18 is both the minimum Go supported by
the 20.10 branch, as well as a very easy jump from 1.17.
Signed-off-by: Bjorn Neergaard <bneergaard@mirantis.com>
| ... | ... |
@@ -10,5 +10,5 @@ set -x |
| 10 | 10 |
SCRIPTDIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
| 11 | 11 |
"${SCRIPTDIR}"/go-mod-prepare.sh
|
| 12 | 12 |
|
| 13 |
-GO111MODULE=auto go mod tidy -modfile 'vendor.mod' -compat 1.17 |
|
| 13 |
+GO111MODULE=auto go mod tidy -modfile 'vendor.mod' -compat 1.18 |
|
| 14 | 14 |
GO111MODULE=auto go mod vendor -modfile vendor.mod |
| ... | ... |
@@ -3,6 +3,7 @@ package plugins // import "github.com/docker/docker/pkg/plugins" |
| 3 | 3 |
import ( |
| 4 | 4 |
"encoding/json" |
| 5 | 5 |
"fmt" |
| 6 |
+ "io/fs" |
|
| 6 | 7 |
"net/url" |
| 7 | 8 |
"os" |
| 8 | 9 |
"path/filepath" |
| ... | ... |
@@ -40,7 +41,7 @@ func Scan() ([]string, error) {
|
| 40 | 40 |
continue |
| 41 | 41 |
} |
| 42 | 42 |
|
| 43 |
- entry = fileInfoToDirEntry(fi) |
|
| 43 |
+ entry = fs.FileInfoToDirEntry(fi) |
|
| 44 | 44 |
} |
| 45 | 45 |
|
| 46 | 46 |
if entry.Type()&os.ModeSocket != 0 {
|
| 9 | 1 |
deleted file mode 100644 |
| ... | ... |
@@ -1,47 +0,0 @@ |
| 1 |
-//go:build !go1.17 |
|
| 2 |
-// +build !go1.17 |
|
| 3 |
- |
|
| 4 |
-// This code is taken from https://github.com/golang/go/blob/go1.17/src/io/fs/readdir.go#L49-L77 |
|
| 5 |
-// and provides the io/fs.FileInfoToDirEntry() utility for go1.16. Go 1.16 and up |
|
| 6 |
-// provide a new implementation of ioutil.ReadDir() (in os.ReadDir()) that returns |
|
| 7 |
-// an os.DirEntry instead of fs.FileInfo. go1.17 added the io/fs.FileInfoToDirEntry() |
|
| 8 |
-// utility to allow existing uses of ReadDir() to get the old type. This utility |
|
| 9 |
-// is not available in go1.16, so we copied it to assist the migration to os.ReadDir(). |
|
| 10 |
- |
|
| 11 |
-// Copyright 2020 The Go Authors. All rights reserved. |
|
| 12 |
-// Use of this source code is governed by a BSD-style |
|
| 13 |
-// license that can be found in the LICENSE file. |
|
| 14 |
- |
|
| 15 |
-package plugins |
|
| 16 |
- |
|
| 17 |
-import "os" |
|
| 18 |
- |
|
| 19 |
-// dirInfo is a DirEntry based on a FileInfo. |
|
| 20 |
-type dirInfo struct {
|
|
| 21 |
- fileInfo os.FileInfo |
|
| 22 |
-} |
|
| 23 |
- |
|
| 24 |
-func (di dirInfo) IsDir() bool {
|
|
| 25 |
- return di.fileInfo.IsDir() |
|
| 26 |
-} |
|
| 27 |
- |
|
| 28 |
-func (di dirInfo) Type() os.FileMode {
|
|
| 29 |
- return di.fileInfo.Mode().Type() |
|
| 30 |
-} |
|
| 31 |
- |
|
| 32 |
-func (di dirInfo) Info() (os.FileInfo, error) {
|
|
| 33 |
- return di.fileInfo, nil |
|
| 34 |
-} |
|
| 35 |
- |
|
| 36 |
-func (di dirInfo) Name() string {
|
|
| 37 |
- return di.fileInfo.Name() |
|
| 38 |
-} |
|
| 39 |
- |
|
| 40 |
-// fileInfoToDirEntry returns a DirEntry that returns information from info. |
|
| 41 |
-// If info is nil, fileInfoToDirEntry returns nil. |
|
| 42 |
-func fileInfoToDirEntry(info os.FileInfo) os.DirEntry {
|
|
| 43 |
- if info == nil {
|
|
| 44 |
- return nil |
|
| 45 |
- } |
|
| 46 |
- return dirInfo{fileInfo: info}
|
|
| 47 |
-} |