summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjorn Neergaard <bneergaard@mirantis.com>2022-09-15 10:19:19 -0600
committerSebastiaan van Stijn <github@gone.nl>2022-11-11 18:01:58 +0100
commitf9ab2094171ac17824b6588ff0711aa62fff0cfc (patch)
treee2ea2c43ab55a4c2fffa0e8af26f0daa52c80c80
parentb76a60dee6b566a2619e97e7c4f049ec34f5df15 (diff)
downloaddocker-f9ab2094171ac17824b6588ff0711aa62fff0cfc.tar.gz
chore: update supported go version to 1.18+
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> (cherry picked from commit 85fa72c599a3c612f4d7a28433c1fcf7db2c3e19) Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
-rwxr-xr-xhack/go-mod-prepare.sh2
-rwxr-xr-xhack/vendor.sh2
-rw-r--r--pkg/plugins/discovery.go3
-rw-r--r--pkg/plugins/utils.go8
-rw-r--r--pkg/plugins/utils_go1.16.go47
-rw-r--r--vendor.mod2
6 files changed, 5 insertions, 59 deletions
diff --git a/hack/go-mod-prepare.sh b/hack/go-mod-prepare.sh
index 793823f2b3..f1fb655a5c 100755
--- a/hack/go-mod-prepare.sh
+++ b/hack/go-mod-prepare.sh
@@ -5,5 +5,5 @@ ROOTDIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
cat > "${ROOTDIR}/go.mod" << EOF
module github.com/docker/docker
-go 1.17
+go 1.18
EOF
diff --git a/hack/vendor.sh b/hack/vendor.sh
index 170c345afb..52eeda2460 100755
--- a/hack/vendor.sh
+++ b/hack/vendor.sh
@@ -10,5 +10,5 @@ set -x
SCRIPTDIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
"${SCRIPTDIR}"/go-mod-prepare.sh
-GO111MODULE=auto go mod tidy -modfile 'vendor.mod' -compat 1.17
+GO111MODULE=auto go mod tidy -modfile 'vendor.mod' -compat 1.18
GO111MODULE=auto go mod vendor -modfile vendor.mod
diff --git a/pkg/plugins/discovery.go b/pkg/plugins/discovery.go
index f24673ed87..9d972b3c21 100644
--- a/pkg/plugins/discovery.go
+++ b/pkg/plugins/discovery.go
@@ -3,6 +3,7 @@ package plugins // import "github.com/docker/docker/pkg/plugins"
import (
"encoding/json"
"fmt"
+ "io/fs"
"net/url"
"os"
"path/filepath"
@@ -40,7 +41,7 @@ func Scan() ([]string, error) {
continue
}
- entry = fileInfoToDirEntry(fi)
+ entry = fs.FileInfoToDirEntry(fi)
}
if entry.Type()&os.ModeSocket != 0 {
diff --git a/pkg/plugins/utils.go b/pkg/plugins/utils.go
deleted file mode 100644
index bd2344ff20..0000000000
--- a/pkg/plugins/utils.go
+++ /dev/null
@@ -1,8 +0,0 @@
-//go:build go1.17
-// +build go1.17
-
-package plugins
-
-import "io/fs"
-
-var fileInfoToDirEntry = fs.FileInfoToDirEntry
diff --git a/pkg/plugins/utils_go1.16.go b/pkg/plugins/utils_go1.16.go
deleted file mode 100644
index ce8c21a039..0000000000
--- a/pkg/plugins/utils_go1.16.go
+++ /dev/null
@@ -1,47 +0,0 @@
-//go:build !go1.17
-// +build !go1.17
-
-// This code is taken from https://github.com/golang/go/blob/go1.17/src/io/fs/readdir.go#L49-L77
-// and provides the io/fs.FileInfoToDirEntry() utility for go1.16. Go 1.16 and up
-// provide a new implementation of ioutil.ReadDir() (in os.ReadDir()) that returns
-// an os.DirEntry instead of fs.FileInfo. go1.17 added the io/fs.FileInfoToDirEntry()
-// utility to allow existing uses of ReadDir() to get the old type. This utility
-// is not available in go1.16, so we copied it to assist the migration to os.ReadDir().
-
-// Copyright 2020 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package plugins
-
-import "os"
-
-// dirInfo is a DirEntry based on a FileInfo.
-type dirInfo struct {
- fileInfo os.FileInfo
-}
-
-func (di dirInfo) IsDir() bool {
- return di.fileInfo.IsDir()
-}
-
-func (di dirInfo) Type() os.FileMode {
- return di.fileInfo.Mode().Type()
-}
-
-func (di dirInfo) Info() (os.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 os.FileInfo) os.DirEntry {
- if info == nil {
- return nil
- }
- return dirInfo{fileInfo: info}
-}
diff --git a/vendor.mod b/vendor.mod
index ece557d8d1..8306699042 100644
--- a/vendor.mod
+++ b/vendor.mod
@@ -4,7 +4,7 @@
module github.com/docker/docker
-go 1.17
+go 1.18
require (
cloud.google.com/go v0.93.3