summaryrefslogtreecommitdiff
path: root/vendor/github.com/docker
diff options
context:
space:
mode:
authorShelley-BaoYue <baoyue2@huawei.com>2023-05-25 17:23:57 +0800
committerfisherxu <xufei40@huawei.com>2023-07-01 03:57:26 +0800
commit95bc4f55be0c27fd3fa4a9433eb689979dd2f913 (patch)
treed3eb7e3c77a64e21565eeb971f0783aa799cbcaf /vendor/github.com/docker
parentMerge pull request #4734 from wenchajun/kubectl-attach (diff)
downloadkubeedge-95bc4f55be0c27fd3fa4a9433eb689979dd2f913.tar.gz
update k8s version to 1.24
Signed-off-by: Shelley-BaoYue <baoyue2@huawei.com>
Diffstat (limited to 'vendor/github.com/docker')
-rw-r--r--vendor/github.com/docker/cli/cli/config/config.go22
-rw-r--r--vendor/github.com/docker/cli/cli/config/configfile/file.go2
-rw-r--r--vendor/github.com/docker/cli/cli/config/configfile/file_unix.go1
-rw-r--r--vendor/github.com/docker/cli/cli/config/credentials/default_store_unsupported.go1
-rw-r--r--vendor/github.com/docker/distribution/.mailmap3
-rw-r--r--vendor/github.com/docker/distribution/Dockerfile8
-rw-r--r--vendor/github.com/docker/distribution/README.md2
-rw-r--r--vendor/github.com/docker/distribution/docker-bake.hcl18
-rw-r--r--vendor/github.com/docker/docker-credential-helpers/client/command.go3
-rw-r--r--vendor/github.com/docker/docker-credential-helpers/credentials/version.go2
-rw-r--r--vendor/github.com/docker/docker/api/common_unix.go1
-rw-r--r--vendor/github.com/docker/docker/api/swagger.yaml17
-rw-r--r--vendor/github.com/docker/docker/api/types/container/hostconfig_unix.go1
-rw-r--r--vendor/github.com/docker/docker/client/client_unix.go1
-rw-r--r--vendor/github.com/docker/docker/client/container_create.go19
-rw-r--r--vendor/github.com/docker/docker/errdefs/http_helpers.go144
-rw-r--r--vendor/github.com/docker/docker/pkg/homedir/homedir_others.go1
-rw-r--r--vendor/github.com/docker/docker/pkg/homedir/homedir_unix.go1
-rw-r--r--vendor/github.com/docker/docker/pkg/ioutils/temp_unix.go1
-rw-r--r--vendor/github.com/docker/docker/pkg/stdcopy/stdcopy.go190
-rw-r--r--vendor/github.com/docker/docker/registry/config_unix.go1
21 files changed, 82 insertions, 357 deletions
diff --git a/vendor/github.com/docker/cli/cli/config/config.go b/vendor/github.com/docker/cli/cli/config/config.go
index 93275f3d9..31ad117d4 100644
--- a/vendor/github.com/docker/cli/cli/config/config.go
+++ b/vendor/github.com/docker/cli/cli/config/config.go
@@ -104,14 +104,18 @@ func LoadFromReader(configData io.Reader) (*configfile.ConfigFile, error) {
return &configFile, err
}
-// TODO remove this temporary hack, which is used to warn about the deprecated ~/.dockercfg file
-var printLegacyFileWarning bool
-
// Load reads the configuration files in the given directory, and sets up
// the auth config information and returns values.
// FIXME: use the internal golang config parser
func Load(configDir string) (*configfile.ConfigFile, error) {
- printLegacyFileWarning = false
+ cfg, _, err := load(configDir)
+ return cfg, err
+}
+
+// TODO remove this temporary hack, which is used to warn about the deprecated ~/.dockercfg file
+// so we can remove the bool return value and collapse this back into `Load`
+func load(configDir string) (*configfile.ConfigFile, bool, error) {
+ printLegacyFileWarning := false
if configDir == "" {
configDir = Dir()
@@ -127,11 +131,11 @@ func Load(configDir string) (*configfile.ConfigFile, error) {
if err != nil {
err = errors.Wrap(err, filename)
}
- return configFile, err
+ return configFile, printLegacyFileWarning, err
} else if !os.IsNotExist(err) {
// if file is there but we can't stat it for any reason other
// than it doesn't exist then stop
- return configFile, errors.Wrap(err, filename)
+ return configFile, printLegacyFileWarning, errors.Wrap(err, filename)
}
// Can't find latest config file so check for the old one
@@ -140,16 +144,16 @@ func Load(configDir string) (*configfile.ConfigFile, error) {
printLegacyFileWarning = true
defer file.Close()
if err := configFile.LegacyLoadFromReader(file); err != nil {
- return configFile, errors.Wrap(err, filename)
+ return configFile, printLegacyFileWarning, errors.Wrap(err, filename)
}
}
- return configFile, nil
+ return configFile, printLegacyFileWarning, nil
}
// LoadDefaultConfigFile attempts to load the default config file and returns
// an initialized ConfigFile struct if none is found.
func LoadDefaultConfigFile(stderr io.Writer) *configfile.ConfigFile {
- configFile, err := Load(Dir())
+ configFile, printLegacyFileWarning, err := load(Dir())
if err != nil {
fmt.Fprintf(stderr, "WARNING: Error loading config file: %v\n", err)
}
diff --git a/vendor/github.com/docker/cli/cli/config/configfile/file.go b/vendor/github.com/docker/cli/cli/config/configfile/file.go
index dc9f39eb7..d6f710817 100644
--- a/vendor/github.com/docker/cli/cli/config/configfile/file.go
+++ b/vendor/github.com/docker/cli/cli/config/configfile/file.go
@@ -119,7 +119,7 @@ func (configFile *ConfigFile) LegacyLoadFromReader(configData io.Reader) error {
// LoadFromReader reads the configuration data given and sets up the auth config
// information with given directory and populates the receiver object
func (configFile *ConfigFile) LoadFromReader(configData io.Reader) error {
- if err := json.NewDecoder(configData).Decode(&configFile); err != nil && !errors.Is(err, io.EOF) {
+ if err := json.NewDecoder(configData).Decode(configFile); err != nil && !errors.Is(err, io.EOF) {
return err
}
var err error
diff --git a/vendor/github.com/docker/cli/cli/config/configfile/file_unix.go b/vendor/github.com/docker/cli/cli/config/configfile/file_unix.go
index 3ca65c614..6af671812 100644
--- a/vendor/github.com/docker/cli/cli/config/configfile/file_unix.go
+++ b/vendor/github.com/docker/cli/cli/config/configfile/file_unix.go
@@ -1,3 +1,4 @@
+//go:build !windows
// +build !windows
package configfile
diff --git a/vendor/github.com/docker/cli/cli/config/credentials/default_store_unsupported.go b/vendor/github.com/docker/cli/cli/config/credentials/default_store_unsupported.go
index 3028168ac..c9630ea51 100644
--- a/vendor/github.com/docker/cli/cli/config/credentials/default_store_unsupported.go
+++ b/vendor/github.com/docker/cli/cli/config/credentials/default_store_unsupported.go
@@ -1,3 +1,4 @@
+//go:build !windows && !darwin && !linux
// +build !windows,!darwin,!linux
package credentials
diff --git a/vendor/github.com/docker/distribution/.mailmap b/vendor/github.com/docker/distribution/.mailmap
index 34421a4ec..8f3738f3d 100644
--- a/vendor/github.com/docker/distribution/.mailmap
+++ b/vendor/github.com/docker/distribution/.mailmap
@@ -44,3 +44,6 @@ Thomas Berger <loki@lokis-chaos.de> Thomas Berger <tbe@users.noreply.github.com>
Samuel Karp <skarp@amazon.com> Samuel Karp <samuelkarp@users.noreply.github.com>
Justin Cormack <justin.cormack@docker.com>
sayboras <sayboras@yahoo.com>
+CrazyMax <github@crazymax.dev>
+CrazyMax <github@crazymax.dev> <1951866+crazy-max@users.noreply.github.com>
+CrazyMax <github@crazymax.dev> <crazy-max@users.noreply.github.com>
diff --git a/vendor/github.com/docker/distribution/Dockerfile b/vendor/github.com/docker/distribution/Dockerfile
index 9d30d3771..ae8c040c7 100644
--- a/vendor/github.com/docker/distribution/Dockerfile
+++ b/vendor/github.com/docker/distribution/Dockerfile
@@ -1,6 +1,6 @@
# syntax=docker/dockerfile:1.3
-ARG GO_VERSION=1.16
+ARG GO_VERSION=1.16.15
ARG GORELEASER_XX_VERSION=1.2.5
FROM --platform=$BUILDPLATFORM crazymax/goreleaser-xx:${GORELEASER_XX_VERSION} AS goreleaser-xx
@@ -12,6 +12,10 @@ WORKDIR /go/src/github.com/docker/distribution
FROM base AS build
ENV GO111MODULE=auto
ENV CGO_ENABLED=0
+# GIT_REF is used by goreleaser-xx to handle the proper git ref when available.
+# It will fallback to the working tree info if empty and use "git tag --points-at"
+# or "git describe" to define the version info.
+ARG GIT_REF
ARG TARGETPLATFORM
ARG PKG="github.com/distribution/distribution"
ARG BUILDTAGS="include_oss include_gcs"
@@ -28,7 +32,7 @@ RUN --mount=type=bind,rw \
--files="LICENSE" \
--files="README.md"
-FROM scratch AS artifacts
+FROM scratch AS artifact
COPY --from=build /out/*.tar.gz /
COPY --from=build /out/*.zip /
COPY --from=build /out/*.sha256 /
diff --git a/vendor/github.com/docker/distribution/README.md b/vendor/github.com/docker/distribution/README.md
index 998878850..e513c18e9 100644
--- a/vendor/github.com/docker/distribution/README.md
+++ b/vendor/github.com/docker/distribution/README.md
@@ -2,7 +2,7 @@
The Docker toolset to pack, ship, store, and deliver content.
-This repository's main product is the Docker Registry 2.0 implementation
+This repository provides the Docker Registry 2.0 implementation
for storing and distributing Docker images. It supersedes the
[docker/docker-registry](https://github.com/docker/docker-registry)
project with a new API design, focused around security and performance.
diff --git a/vendor/github.com/docker/distribution/docker-bake.hcl b/vendor/github.com/docker/distribution/docker-bake.hcl
index e1457bb81..4dd5a100c 100644
--- a/vendor/github.com/docker/distribution/docker-bake.hcl
+++ b/vendor/github.com/docker/distribution/docker-bake.hcl
@@ -1,3 +1,15 @@
+// GITHUB_REF is the actual ref that triggers the workflow
+// https://docs.github.com/en/actions/learn-github-actions/environment-variables#default-environment-variables
+variable "GITHUB_REF" {
+ default = ""
+}
+
+target "_common" {
+ args = {
+ GIT_REF = GITHUB_REF
+ }
+}
+
group "default" {
targets = ["image-local"]
}
@@ -8,12 +20,14 @@ target "docker-metadata-action" {
}
target "binary" {
+ inherits = ["_common"]
target = "binary"
output = ["./bin"]
}
target "artifact" {
- target = "artifacts"
+ inherits = ["_common"]
+ target = "artifact"
output = ["./bin"]
}
@@ -30,7 +44,7 @@ target "artifact-all" {
}
target "image" {
- inherits = ["docker-metadata-action"]
+ inherits = ["_common", "docker-metadata-action"]
}
target "image-local" {
diff --git a/vendor/github.com/docker/docker-credential-helpers/client/command.go b/vendor/github.com/docker/docker-credential-helpers/client/command.go
index 8da334306..0183c0639 100644
--- a/vendor/github.com/docker/docker-credential-helpers/client/command.go
+++ b/vendor/github.com/docker/docker-credential-helpers/client/command.go
@@ -4,7 +4,8 @@ import (
"fmt"
"io"
"os"
- "os/exec"
+
+ exec "golang.org/x/sys/execabs"
)
// Program is an interface to execute external programs.
diff --git a/vendor/github.com/docker/docker-credential-helpers/credentials/version.go b/vendor/github.com/docker/docker-credential-helpers/credentials/version.go
index c2cc3e2e0..185e36796 100644
--- a/vendor/github.com/docker/docker-credential-helpers/credentials/version.go
+++ b/vendor/github.com/docker/docker-credential-helpers/credentials/version.go
@@ -1,4 +1,4 @@
package credentials
// Version holds a string describing the current version
-const Version = "0.6.3"
+const Version = "0.6.4"
diff --git a/vendor/github.com/docker/docker/api/common_unix.go b/vendor/github.com/docker/docker/api/common_unix.go
index 504b0c90d..19fc63d65 100644
--- a/vendor/github.com/docker/docker/api/common_unix.go
+++ b/vendor/github.com/docker/docker/api/common_unix.go
@@ -1,3 +1,4 @@
+//go:build !windows
// +build !windows
package api // import "github.com/docker/docker/api"
diff --git a/vendor/github.com/docker/docker/api/swagger.yaml b/vendor/github.com/docker/docker/api/swagger.yaml
index 1294e5a22..0bbe74700 100644
--- a/vendor/github.com/docker/docker/api/swagger.yaml
+++ b/vendor/github.com/docker/docker/api/swagger.yaml
@@ -3347,7 +3347,7 @@ definitions:
Limits:
description: "Define resources limits."
$ref: "#/definitions/Limit"
- Reservation:
+ Reservations:
description: "Define resources reservation."
$ref: "#/definitions/ResourceObject"
RestartPolicy:
@@ -5583,12 +5583,12 @@ paths:
schema:
$ref: "#/definitions/ErrorResponse"
404:
- description: "no such container"
+ description: "no such image"
schema:
$ref: "#/definitions/ErrorResponse"
examples:
application/json:
- message: "No such container: c2ada9df5af8"
+ message: "No such image: c2ada9df5af8"
409:
description: "conflict"
schema:
@@ -5755,7 +5755,6 @@ paths:
property1: "string"
property2: "string"
IpcMode: ""
- LxcConf: []
Memory: 0
MemorySwap: 0
MemoryReservation: 0
@@ -8607,12 +8606,20 @@ paths:
if `tty` was specified as part of creating and starting the exec instance.
operationId: "ExecResize"
responses:
- 201:
+ 200:
description: "No error"
+ 400:
+ description: "bad parameter"
+ schema:
+ $ref: "#/definitions/ErrorResponse"
404:
description: "No such exec instance"
schema:
$ref: "#/definitions/ErrorResponse"
+ 500:
+ description: "Server error"
+ schema:
+ $ref: "#/definitions/ErrorResponse"
parameters:
- name: "id"
in: "path"
diff --git a/vendor/github.com/docker/docker/api/types/container/hostconfig_unix.go b/vendor/github.com/docker/docker/api/types/container/hostconfig_unix.go
index cf6fdf440..24c4fa8d9 100644
--- a/vendor/github.com/docker/docker/api/types/container/hostconfig_unix.go
+++ b/vendor/github.com/docker/docker/api/types/container/hostconfig_unix.go
@@ -1,3 +1,4 @@
+//go:build !windows
// +build !windows
package container // import "github.com/docker/docker/api/types/container"
diff --git a/vendor/github.com/docker/docker/client/client_unix.go b/vendor/github.com/docker/docker/client/client_unix.go
index 9d0f0dcbf..5846f888f 100644
--- a/vendor/github.com/docker/docker/client/client_unix.go
+++ b/vendor/github.com/docker/docker/client/client_unix.go
@@ -1,3 +1,4 @@
+//go:build linux || freebsd || openbsd || netbsd || darwin || solaris || illumos || dragonfly
// +build linux freebsd openbsd netbsd darwin solaris illumos dragonfly
package client // import "github.com/docker/docker/client"
diff --git a/vendor/github.com/docker/docker/client/container_create.go b/vendor/github.com/docker/docker/client/container_create.go
index b1d5fea5b..c5079ee53 100644
--- a/vendor/github.com/docker/docker/client/container_create.go
+++ b/vendor/github.com/docker/docker/client/container_create.go
@@ -4,8 +4,8 @@ import (
"context"
"encoding/json"
"net/url"
+ "path"
- "github.com/containerd/containerd/platforms"
"github.com/docker/docker/api/types/container"
"github.com/docker/docker/api/types/network"
"github.com/docker/docker/api/types/versions"
@@ -16,7 +16,6 @@ type configWrapper struct {
*container.Config
HostConfig *container.HostConfig
NetworkingConfig *network.NetworkingConfig
- Platform *specs.Platform
}
// ContainerCreate creates a new container based in the given configuration.
@@ -38,8 +37,8 @@ func (cli *Client) ContainerCreate(ctx context.Context, config *container.Config
}
query := url.Values{}
- if platform != nil {
- query.Set("platform", platforms.Format(*platform))
+ if p := formatPlatform(platform); p != "" {
+ query.Set("platform", p)
}
if containerName != "" {
@@ -61,3 +60,15 @@ func (cli *Client) ContainerCreate(ctx context.Context, config *container.Config
err = json.NewDecoder(serverResp.body).Decode(&response)
return response, err
}
+
+// formatPlatform returns a formatted string representing platform (e.g. linux/arm/v7).
+//
+// Similar to containerd's platforms.Format(), but does allow components to be
+// omitted (e.g. pass "architecture" only, without "os":
+// https://github.com/containerd/containerd/blob/v1.5.2/platforms/platforms.go#L243-L263
+func formatPlatform(platform *specs.Platform) string {
+ if platform == nil {
+ return ""
+ }
+ return path.Join(platform.OS, platform.Architecture, platform.Variant)
+}
diff --git a/vendor/github.com/docker/docker/errdefs/http_helpers.go b/vendor/github.com/docker/docker/errdefs/http_helpers.go
index 07552f1cc..5afe48677 100644
--- a/vendor/github.com/docker/docker/errdefs/http_helpers.go
+++ b/vendor/github.com/docker/docker/errdefs/http_helpers.go
@@ -1,78 +1,11 @@
package errdefs // import "github.com/docker/docker/errdefs"
import (
- "fmt"
"net/http"
- containerderrors "github.com/containerd/containerd/errdefs"
- "github.com/docker/distribution/registry/api/errcode"
"github.com/sirupsen/logrus"
- "google.golang.org/grpc/codes"
- "google.golang.org/grpc/status"
)
-// GetHTTPErrorStatusCode retrieves status code from error message.
-func GetHTTPErrorStatusCode(err error) int {
- if err == nil {
- logrus.WithFields(logrus.Fields{"error": err}).Error("unexpected HTTP error handling")
- return http.StatusInternalServerError
- }
-
- var statusCode int
-
- // Stop right there
- // Are you sure you should be adding a new error class here? Do one of the existing ones work?
-
- // Note that the below functions are already checking the error causal chain for matches.
- switch {
- case IsNotFound(err):
- statusCode = http.StatusNotFound
- case IsInvalidParameter(err):
- statusCode = http.StatusBadRequest
- case IsConflict(err):
- statusCode = http.StatusConflict
- case IsUnauthorized(err):
- statusCode = http.StatusUnauthorized
- case IsUnavailable(err):
- statusCode = http.StatusServiceUnavailable
- case IsForbidden(err):
- statusCode = http.StatusForbidden
- case IsNotModified(err):
- statusCode = http.StatusNotModified
- case IsNotImplemented(err):
- statusCode = http.StatusNotImplemented
- case IsSystem(err) || IsUnknown(err) || IsDataLoss(err) || IsDeadline(err) || IsCancelled(err):
- statusCode = http.StatusInternalServerError
- default:
- statusCode = statusCodeFromGRPCError(err)
- if statusCode != http.StatusInternalServerError {
- return statusCode
- }
- statusCode = statusCodeFromContainerdError(err)
- if statusCode != http.StatusInternalServerError {
- return statusCode
- }
- statusCode = statusCodeFromDistributionError(err)
- if statusCode != http.StatusInternalServerError {
- return statusCode
- }
- if e, ok := err.(causer); ok {
- return GetHTTPErrorStatusCode(e.Cause())
- }
-
- logrus.WithFields(logrus.Fields{
- "module": "api",
- "error_type": fmt.Sprintf("%T", err),
- }).Debugf("FIXME: Got an API for which error does not match any expected type!!!: %+v", err)
- }
-
- if statusCode == 0 {
- statusCode = http.StatusInternalServerError
- }
-
- return statusCode
-}
-
// FromStatusCode creates an errdef error, based on the provided HTTP status-code
func FromStatusCode(err error, statusCode int) error {
if err == nil {
@@ -100,10 +33,10 @@ func FromStatusCode(err error, statusCode int) error {
err = System(err)
}
default:
- logrus.WithFields(logrus.Fields{
+ logrus.WithError(err).WithFields(logrus.Fields{
"module": "api",
- "status_code": fmt.Sprintf("%d", statusCode),
- }).Debugf("FIXME: Got an status-code for which error does not match any expected type!!!: %d", statusCode)
+ "status_code": statusCode,
+ }).Debug("FIXME: Got an status-code for which error does not match any expected type!!!")
switch {
case statusCode >= 200 && statusCode < 400:
@@ -118,74 +51,3 @@ func FromStatusCode(err error, statusCode int) error {
}
return err
}
-
-// statusCodeFromGRPCError returns status code according to gRPC error
-func statusCodeFromGRPCError(err error) int {
- switch status.Code(err) {
- case codes.InvalidArgument: // code 3
- return http.StatusBadRequest
- case codes.NotFound: // code 5
- return http.StatusNotFound
- case codes.AlreadyExists: // code 6
- return http.StatusConflict
- case codes.PermissionDenied: // code 7
- return http.StatusForbidden
- case codes.FailedPrecondition: // code 9
- return http.StatusBadRequest
- case codes.Unauthenticated: // code 16
- return http.StatusUnauthorized
- case codes.OutOfRange: // code 11
- return http.StatusBadRequest
- case codes.Unimplemented: // code 12
- return http.StatusNotImplemented
- case codes.Unavailable: // code 14
- return http.StatusServiceUnavailable
- default:
- // codes.Canceled(1)
- // codes.Unknown(2)
- // codes.DeadlineExceeded(4)
- // codes.ResourceExhausted(8)
- // codes.Aborted(10)
- // codes.Internal(13)
- // codes.DataLoss(15)
- return http.StatusInternalServerError
- }
-}
-
-// statusCodeFromDistributionError returns status code according to registry errcode
-// code is loosely based on errcode.ServeJSON() in docker/distribution
-func statusCodeFromDistributionError(err error) int {
- switch errs := err.(type) {
- case errcode.Errors:
- if len(errs) < 1 {
- return http.StatusInternalServerError
- }
- if _, ok := errs[0].(errcode.ErrorCoder); ok {
- return statusCodeFromDistributionError(errs[0])
- }
- case errcode.ErrorCoder:
- return errs.ErrorCode().Descriptor().HTTPStatusCode
- }
- return http.StatusInternalServerError
-}
-
-// statusCodeFromContainerdError returns status code for containerd errors when
-// consumed directly (not through gRPC)
-func statusCodeFromContainerdError(err error) int {
- switch {
- case containerderrors.IsInvalidArgument(err):
- return http.StatusBadRequest
- case containerderrors.IsNotFound(err):
- return http.StatusNotFound
- case containerderrors.IsAlreadyExists(err):
- return http.StatusConflict
- case containerderrors.IsFailedPrecondition(err):
- return http.StatusPreconditionFailed
- case containerderrors.IsUnavailable(err):
- return http.StatusServiceUnavailable
- case containerderrors.IsNotImplemented(err):
- return http.StatusNotImplemented
- default:
- return http.StatusInternalServerError
- }
-}
diff --git a/vendor/github.com/docker/docker/pkg/homedir/homedir_others.go b/vendor/github.com/docker/docker/pkg/homedir/homedir_others.go
index 67ab9e9b3..fc48e674c 100644
--- a/vendor/github.com/docker/docker/pkg/homedir/homedir_others.go
+++ b/vendor/github.com/docker/docker/pkg/homedir/homedir_others.go
@@ -1,3 +1,4 @@
+//go:build !linux
// +build !linux
package homedir // import "github.com/docker/docker/pkg/homedir"
diff --git a/vendor/github.com/docker/docker/pkg/homedir/homedir_unix.go b/vendor/github.com/docker/docker/pkg/homedir/homedir_unix.go
index 441bd727b..d1732dee5 100644
--- a/vendor/github.com/docker/docker/pkg/homedir/homedir_unix.go
+++ b/vendor/github.com/docker/docker/pkg/homedir/homedir_unix.go
@@ -1,3 +1,4 @@
+//go:build !windows
// +build !windows
package homedir // import "github.com/docker/docker/pkg/homedir"
diff --git a/vendor/github.com/docker/docker/pkg/ioutils/temp_unix.go b/vendor/github.com/docker/docker/pkg/ioutils/temp_unix.go
index dc894f913..4e67ec2f5 100644
--- a/vendor/github.com/docker/docker/pkg/ioutils/temp_unix.go
+++ b/vendor/github.com/docker/docker/pkg/ioutils/temp_unix.go
@@ -1,3 +1,4 @@
+//go:build !windows
// +build !windows
package ioutils // import "github.com/docker/docker/pkg/ioutils"
diff --git a/vendor/github.com/docker/docker/pkg/stdcopy/stdcopy.go b/vendor/github.com/docker/docker/pkg/stdcopy/stdcopy.go
deleted file mode 100644
index 8f6e0a737..000000000
--- a/vendor/github.com/docker/docker/pkg/stdcopy/stdcopy.go
+++ /dev/null
@@ -1,190 +0,0 @@
-package stdcopy // import "github.com/docker/docker/pkg/stdcopy"
-
-import (
- "bytes"
- "encoding/binary"
- "errors"
- "fmt"
- "io"
- "sync"
-)
-
-// StdType is the type of standard stream
-// a writer can multiplex to.
-type StdType byte
-
-const (
- // Stdin represents standard input stream type.
- Stdin StdType = iota
- // Stdout represents standard output stream type.
- Stdout
- // Stderr represents standard error steam type.
- Stderr
- // Systemerr represents errors originating from the system that make it
- // into the multiplexed stream.
- Systemerr
-
- stdWriterPrefixLen = 8
- stdWriterFdIndex = 0
- stdWriterSizeIndex = 4
-
- startingBufLen = 32*1024 + stdWriterPrefixLen + 1
-)
-
-var bufPool = &sync.Pool{New: func() interface{} { return bytes.NewBuffer(nil) }}
-
-// stdWriter is wrapper of io.Writer with extra customized info.
-type stdWriter struct {
- io.Writer
- prefix byte
-}
-
-// Write sends the buffer to the underneath writer.
-// It inserts the prefix header before the buffer,
-// so stdcopy.StdCopy knows where to multiplex the output.
-// It makes stdWriter to implement io.Writer.
-func (w *stdWriter) Write(p []byte) (n int, err error) {
- if w == nil || w.Writer == nil {
- return 0, errors.New("Writer not instantiated")
- }
- if p == nil {
- return 0, nil
- }
-
- header := [stdWriterPrefixLen]byte{stdWriterFdIndex: w.prefix}
- binary.BigEndian.PutUint32(header[stdWriterSizeIndex:], uint32(len(p)))
- buf := bufPool.Get().(*bytes.Buffer)
- buf.Write(header[:])
- buf.Write(p)
-
- n, err = w.Writer.Write(buf.Bytes())
- n -= stdWriterPrefixLen
- if n < 0 {
- n = 0
- }
-
- buf.Reset()
- bufPool.Put(buf)
- return
-}
-
-// NewStdWriter instantiates a new Writer.
-// Everything written to it will be encapsulated using a custom format,
-// and written to the underlying `w` stream.
-// This allows multiple write streams (e.g. stdout and stderr) to be muxed into a single connection.
-// `t` indicates the id of the stream to encapsulate.
-// It can be stdcopy.Stdin, stdcopy.Stdout, stdcopy.Stderr.
-func NewStdWriter(w io.Writer, t StdType) io.Writer {
- return &stdWriter{
- Writer: w,
- prefix: byte(t),
- }
-}
-
-// StdCopy is a modified version of io.Copy.
-//
-// StdCopy will demultiplex `src`, assuming that it contains two streams,
-// previously multiplexed together using a StdWriter instance.
-// As it reads from `src`, StdCopy will write to `dstout` and `dsterr`.
-//
-// StdCopy will read until it hits EOF on `src`. It will then return a nil error.
-// In other words: if `err` is non nil, it indicates a real underlying error.
-//
-// `written` will hold the total number of bytes written to `dstout` and `dsterr`.
-func StdCopy(dstout, dsterr io.Writer, src io.Reader) (written int64, err error) {
- var (
- buf = make([]byte, startingBufLen)
- bufLen = len(buf)
- nr, nw int
- er, ew error
- out io.Writer
- frameSize int
- )
-
- for {
- // Make sure we have at least a full header
- for nr < stdWriterPrefixLen {
- var nr2 int
- nr2, er = src.Read(buf[nr:])
- nr += nr2
- if er == io.EOF {
- if nr < stdWriterPrefixLen {
- return written, nil
- }
- break
- }
- if er != nil {
- return 0, er
- }
- }
-
- stream := StdType(buf[stdWriterFdIndex])
- // Check the first byte to know where to write
- switch stream {
- case Stdin:
- fallthrough
- case Stdout:
- // Write on stdout
- out = dstout
- case Stderr:
- // Write on stderr
- out = dsterr
- case Systemerr:
- // If we're on Systemerr, we won't write anywhere.
- // NB: if this code changes later, make sure you don't try to write
- // to outstream if Systemerr is the stream
- out = nil
- default:
- return 0, fmt.Errorf("Unrecognized input header: %d", buf[stdWriterFdIndex])
- }
-
- // Retrieve the size of the frame
- frameSize = int(binary.BigEndian.Uint32(buf[stdWriterSizeIndex : stdWriterSizeIndex+4]))
-
- // Check if the buffer is big enough to read the frame.
- // Extend it if necessary.
- if frameSize+stdWriterPrefixLen > bufLen {
- buf = append(buf, make([]byte, frameSize+stdWriterPrefixLen-bufLen+1)...)
- bufLen = len(buf)
- }
-
- // While the amount of bytes read is less than the size of the frame + header, we keep reading
- for nr < frameSize+stdWriterPrefixLen {
- var nr2 int
- nr2, er = src.Read(buf[nr:])
- nr += nr2
- if er == io.EOF {
- if nr < frameSize+stdWriterPrefixLen {
- return written, nil
- }
- break
- }
- if er != nil {
- return 0, er
- }
- }
-
- // we might have an error from the source mixed up in our multiplexed
- // stream. if we do, return it.
- if stream == Systemerr {
- return written, fmt.Errorf("error from daemon in stream: %s", string(buf[stdWriterPrefixLen:frameSize+stdWriterPrefixLen]))
- }
-
- // Write the retrieved frame (without header)
- nw, ew = out.Write(buf[stdWriterPrefixLen : frameSize+stdWriterPrefixLen])
- if ew != nil {
- return 0, ew
- }
-
- // If the frame has not been fully written: error
- if nw != frameSize {
- return 0, io.ErrShortWrite
- }
- written += int64(nw)
-
- // Move the rest of the buffer to the beginning
- copy(buf, buf[frameSize+stdWriterPrefixLen:])
- // Move the index
- nr -= frameSize + stdWriterPrefixLen
- }
-}
diff --git a/vendor/github.com/docker/docker/registry/config_unix.go b/vendor/github.com/docker/docker/registry/config_unix.go
index 8ee8fedfc..b5bb31cfa 100644
--- a/vendor/github.com/docker/docker/registry/config_unix.go
+++ b/vendor/github.com/docker/docker/registry/config_unix.go
@@ -1,3 +1,4 @@
+//go:build !windows
// +build !windows
package registry // import "github.com/docker/docker/registry"