From c0a75ea18d7e438b123c3a7967bac35a15eb7605 Mon Sep 17 00:00:00 2001 From: Drew Erny Date: Wed, 18 Oct 2017 14:41:59 -0700 Subject: [PATCH 1/7] Output network attachment task information Adds functionality to parse and return network attachment spec information. Network attachment tasks are phony tasks created in swarmkit to deal with unmanaged containers attached to swarmkit. Before this change, attempting `docker inspect` on the task id of a network attachment task would result in an empty task object. After this change, a full task object is returned Fixes #26548 the correct way. Signed-off-by: Drew Erny Signed-off-by: Sebastiaan van Stijn Upstream-commit: 5b69ff466e61fa168f24869710f2070c742a5565 Component: engine --- components/engine/api/swagger.yaml | 7 ++ components/engine/api/types/swarm/runtime.go | 8 ++ components/engine/api/types/swarm/task.go | 11 ++- .../engine/daemon/cluster/convert/service.go | 38 ++++++++-- .../daemon/cluster/convert/service_test.go | 74 +++++++++++++++++++ .../engine/daemon/cluster/convert/task.go | 3 - components/engine/daemon/cluster/services.go | 4 + 7 files changed, 132 insertions(+), 13 deletions(-) diff --git a/components/engine/api/swagger.yaml b/components/engine/api/swagger.yaml index 459ce9b186..c0b442416d 100644 --- a/components/engine/api/swagger.yaml +++ b/components/engine/api/swagger.yaml @@ -2688,6 +2688,13 @@ definitions: - "default" - "process" - "hyperv" + NetworkAttachmentSpec: + description: "Read-only spec type for non-swarm containers attached to swarm overlay networks" + type: "object" + properties: + ContainerID: + description: "ID of the container represented by this task" + type: "string" Resources: description: "Resource requirements which apply to each individual container created as part of the service." type: "object" diff --git a/components/engine/api/types/swarm/runtime.go b/components/engine/api/types/swarm/runtime.go index 81b5f4cfd9..0c77403ccf 100644 --- a/components/engine/api/types/swarm/runtime.go +++ b/components/engine/api/types/swarm/runtime.go @@ -11,9 +11,17 @@ const ( RuntimeContainer RuntimeType = "container" // RuntimePlugin is the plugin based runtime RuntimePlugin RuntimeType = "plugin" + // RuntimeNetworkAttachment is the network attachment runtime + RuntimeNetworkAttachment RuntimeType = "attachment" // RuntimeURLContainer is the proto url for the container type RuntimeURLContainer RuntimeURL = "types.docker.com/RuntimeContainer" // RuntimeURLPlugin is the proto url for the plugin type RuntimeURLPlugin RuntimeURL = "types.docker.com/RuntimePlugin" ) + +// NetworkAttachmentSpec represents the runtime spec type for network +// attachment tasks +type NetworkAttachmentSpec struct { + ContainerID string +} diff --git a/components/engine/api/types/swarm/task.go b/components/engine/api/types/swarm/task.go index 5c2bc492e4..b35605d12f 100644 --- a/components/engine/api/types/swarm/task.go +++ b/components/engine/api/types/swarm/task.go @@ -60,10 +60,13 @@ type Task struct { // TaskSpec represents the spec of a task. type TaskSpec struct { - // ContainerSpec and PluginSpec are mutually exclusive. - // PluginSpec will only be used when the `Runtime` field is set to `plugin` - ContainerSpec *ContainerSpec `json:",omitempty"` - PluginSpec *runtime.PluginSpec `json:",omitempty"` + // ContainerSpec, NetworkAttachmentSpec, and PluginSpec are mutually exclusive. + // PluginSpec is only used when the `Runtime` field is set to `plugin` + // NetworkAttachmentSpec is used if the `Runtime` field is set to + // `attachment`. + ContainerSpec *ContainerSpec `json:",omitempty"` + PluginSpec *runtime.PluginSpec `json:",omitempty"` + NetworkAttachmentSpec *NetworkAttachmentSpec `json:",omitempty"` Resources *ResourceRequirements `json:",omitempty"` RestartPolicy *RestartPolicy `json:",omitempty"` diff --git a/components/engine/daemon/cluster/convert/service.go b/components/engine/daemon/cluster/convert/service.go index 7aa34fa77f..5a1609aa01 100644 --- a/components/engine/daemon/cluster/convert/service.go +++ b/components/engine/daemon/cluster/convert/service.go @@ -17,6 +17,8 @@ import ( var ( // ErrUnsupportedRuntime returns an error if the runtime is not supported by the daemon ErrUnsupportedRuntime = errors.New("unsupported runtime") + // ErrMismatchedRuntime returns an error if the runtime does not match the provided spec + ErrMismatchedRuntime = errors.New("mismatched Runtime and *Spec fields") ) // ServiceFromGRPC converts a grpc Service to a Service. @@ -176,15 +178,18 @@ func ServiceSpecToGRPC(s types.ServiceSpec) (swarmapi.ServiceSpec, error) { return swarmapi.ServiceSpec{}, err } spec.Task.Runtime = &swarmapi.TaskSpec_Container{Container: containerSpec} + } else { + // If the ContainerSpec is nil, we can't set the task runtime + return swarmapi.ServiceSpec{}, ErrMismatchedRuntime } case types.RuntimePlugin: - if s.Mode.Replicated != nil { - return swarmapi.ServiceSpec{}, errors.New("plugins must not use replicated mode") - } - - s.Mode.Global = &types.GlobalService{} // must always be global - if s.TaskTemplate.PluginSpec != nil { + if s.Mode.Replicated != nil { + return swarmapi.ServiceSpec{}, errors.New("plugins must not use replicated mode") + } + + s.Mode.Global = &types.GlobalService{} // must always be global + pluginSpec, err := proto.Marshal(s.TaskTemplate.PluginSpec) if err != nil { return swarmapi.ServiceSpec{}, err @@ -198,7 +203,16 @@ func ServiceSpecToGRPC(s types.ServiceSpec) (swarmapi.ServiceSpec, error) { }, }, } + } else { + return swarmapi.ServiceSpec{}, ErrMismatchedRuntime } + case types.RuntimeNetworkAttachment: + // NOTE(dperny) I'm leaving this case here for completeness. The actual + // code is left out out deliberately, as we should refuse to parse a + // Network Attachment runtime; it will cause weird behavior all over + // the system if we do. Instead, fallthrough and return + // ErrUnsupportedRuntime if we get one. + fallthrough default: return swarmapi.ServiceSpec{}, ErrUnsupportedRuntime } @@ -573,6 +587,12 @@ func updateConfigToGRPC(updateConfig *types.UpdateConfig) (*swarmapi.UpdateConfi return converted, nil } +func networkAttachmentSpecFromGRPC(attachment swarmapi.NetworkAttachmentSpec) *types.NetworkAttachmentSpec { + return &types.NetworkAttachmentSpec{ + ContainerID: attachment.ContainerID, + } +} + func taskSpecFromGRPC(taskSpec swarmapi.TaskSpec) (types.TaskSpec, error) { taskNetworks := make([]types.NetworkAttachmentConfig, 0, len(taskSpec.Networks)) for _, n := range taskSpec.Networks { @@ -607,6 +627,12 @@ func taskSpecFromGRPC(taskSpec swarmapi.TaskSpec) (types.TaskSpec, error) { t.PluginSpec = &p } } + case *swarmapi.TaskSpec_Attachment: + a := taskSpec.GetAttachment() + if a != nil { + t.NetworkAttachmentSpec = networkAttachmentSpecFromGRPC(*a) + } + t.Runtime = types.RuntimeNetworkAttachment } return t, nil diff --git a/components/engine/daemon/cluster/convert/service_test.go b/components/engine/daemon/cluster/convert/service_test.go index 0794af99a6..826cf6fbef 100644 --- a/components/engine/daemon/cluster/convert/service_test.go +++ b/components/engine/daemon/cluster/convert/service_test.go @@ -232,3 +232,77 @@ func TestServiceConvertFromGRPCIsolation(t *testing.T) { }) } } + +func TestServiceConvertToGRPCNetworkAtachmentRuntime(t *testing.T) { + someid := "asfjkl" + s := swarmtypes.ServiceSpec{ + TaskTemplate: swarmtypes.TaskSpec{ + Runtime: swarmtypes.RuntimeNetworkAttachment, + NetworkAttachmentSpec: &swarmtypes.NetworkAttachmentSpec{ + ContainerID: someid, + }, + }, + } + + // discard the service, which will be empty + _, err := ServiceSpecToGRPC(s) + if err == nil { + t.Fatalf("expected error %v but got no error", ErrUnsupportedRuntime) + } + if err != ErrUnsupportedRuntime { + t.Fatalf("expected error %v but got error %v", ErrUnsupportedRuntime, err) + } +} + +func TestServiceConvertToGRPCMismatchedRuntime(t *testing.T) { + // NOTE(dperny): an earlier version of this test was for code that also + // converted network attachment tasks to GRPC. that conversion code was + // removed, so if this loop body seems a bit complicated, that's why. + for i, rt := range []swarmtypes.RuntimeType{ + swarmtypes.RuntimeContainer, + swarmtypes.RuntimePlugin, + } { + for j, spec := range []swarmtypes.TaskSpec{ + {ContainerSpec: &swarmtypes.ContainerSpec{}}, + {PluginSpec: &runtime.PluginSpec{}}, + } { + // skip the cases, where the indices match, which would not error + if i == j { + continue + } + // set the task spec, then change the runtime + s := swarmtypes.ServiceSpec{ + TaskTemplate: spec, + } + s.TaskTemplate.Runtime = rt + + if _, err := ServiceSpecToGRPC(s); err != ErrMismatchedRuntime { + t.Fatalf("expected %v got %v", ErrMismatchedRuntime, err) + } + } + } +} + +func TestTaskConvertFromGRPCNetworkAttachment(t *testing.T) { + containerID := "asdfjkl" + s := swarmapi.TaskSpec{ + Runtime: &swarmapi.TaskSpec_Attachment{ + Attachment: &swarmapi.NetworkAttachmentSpec{ + ContainerID: containerID, + }, + }, + } + ts, err := taskSpecFromGRPC(s) + if err != nil { + t.Fatal(err) + } + if ts.NetworkAttachmentSpec == nil { + t.Fatal("expected task spec to have network attachment spec") + } + if ts.NetworkAttachmentSpec.ContainerID != containerID { + t.Fatalf("expected network attachment spec container id to be %q, was %q", containerID, ts.NetworkAttachmentSpec.ContainerID) + } + if ts.Runtime != swarmtypes.RuntimeNetworkAttachment { + t.Fatalf("expected Runtime to be %v", swarmtypes.RuntimeNetworkAttachment) + } +} diff --git a/components/engine/daemon/cluster/convert/task.go b/components/engine/daemon/cluster/convert/task.go index dbe6d7414d..72e2805e1e 100644 --- a/components/engine/daemon/cluster/convert/task.go +++ b/components/engine/daemon/cluster/convert/task.go @@ -10,9 +10,6 @@ import ( // TaskFromGRPC converts a grpc Task to a Task. func TaskFromGRPC(t swarmapi.Task) (types.Task, error) { - if t.Spec.GetAttachment() != nil { - return types.Task{}, nil - } containerStatus := t.Status.GetContainer() taskSpec, err := taskSpecFromGRPC(t.Spec) if err != nil { diff --git a/components/engine/daemon/cluster/services.go b/components/engine/daemon/cluster/services.go index ed438e93a0..c14037645c 100644 --- a/components/engine/daemon/cluster/services.go +++ b/components/engine/daemon/cluster/services.go @@ -135,6 +135,8 @@ func (c *Cluster) CreateService(s types.ServiceSpec, encodedAuth string, queryRe resp = &apitypes.ServiceCreateResponse{} switch serviceSpec.Task.Runtime.(type) { + case *swarmapi.TaskSpec_Attachment: + return fmt.Errorf("invalid task spec: spec type %q not supported", types.RuntimeNetworkAttachment) // handle other runtimes here case *swarmapi.TaskSpec_Generic: switch serviceSpec.Task.GetGeneric().Kind { @@ -244,6 +246,8 @@ func (c *Cluster) UpdateService(serviceIDOrName string, version uint64, spec typ resp = &apitypes.ServiceUpdateResponse{} switch serviceSpec.Task.Runtime.(type) { + case *swarmapi.TaskSpec_Attachment: + return fmt.Errorf("invalid task spec: spec type %q not supported", types.RuntimeNetworkAttachment) case *swarmapi.TaskSpec_Generic: switch serviceSpec.Task.GetGeneric().Kind { case string(types.RuntimePlugin): From 53104fbd7ccdff2f5549a4087bac5335f8408ee6 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Tue, 22 May 2018 23:37:33 +0200 Subject: [PATCH 2/7] Update swagger and API history Signed-off-by: Sebastiaan van Stijn Upstream-commit: 3682703ad4a75ea489aa84cbaddcfa4697a4e57e Component: engine --- components/engine/api/swagger.yaml | 31 +++++++++++++++++-- components/engine/docs/api/version-history.md | 6 ++++ 2 files changed, 34 insertions(+), 3 deletions(-) diff --git a/components/engine/api/swagger.yaml b/components/engine/api/swagger.yaml index c0b442416d..3c0c272e5c 100644 --- a/components/engine/api/swagger.yaml +++ b/components/engine/api/swagger.yaml @@ -2449,7 +2449,15 @@ definitions: properties: PluginSpec: type: "object" - description: "Invalid when specified with `ContainerSpec`. *(Experimental release only.)*" + description: | + Plugin spec for the service. *(Experimental release only.)* + +


+ + > **Note**: ContainerSpec, NetworkAttachmentSpec, and PluginSpec are + > mutually exclusive. PluginSpec is only used when the Runtime field + > is set to `plugin`. NetworkAttachmentSpec is used when the Runtime + > field is set to `attachment`. properties: Name: description: "The name or 'alias' to use for the plugin." @@ -2476,7 +2484,15 @@ definitions: type: "string" ContainerSpec: type: "object" - description: "Invalid when specified with `PluginSpec`." + description: | + Container spec for the service. + +


+ + > **Note**: ContainerSpec, NetworkAttachmentSpec, and PluginSpec are + > mutually exclusive. PluginSpec is only used when the Runtime field + > is set to `plugin`. NetworkAttachmentSpec is used when the Runtime + > field is set to `attachment`. properties: Image: description: "The image name to use for the container" @@ -2689,7 +2705,16 @@ definitions: - "process" - "hyperv" NetworkAttachmentSpec: - description: "Read-only spec type for non-swarm containers attached to swarm overlay networks" + description: | + Read-only spec type for non-swarm containers attached to swarm overlay + networks. + +


+ + > **Note**: ContainerSpec, NetworkAttachmentSpec, and PluginSpec are + > mutually exclusive. PluginSpec is only used when the Runtime field + > is set to `plugin`. NetworkAttachmentSpec is used when the Runtime + > field is set to `attachment`. type: "object" properties: ContainerID: diff --git a/components/engine/docs/api/version-history.md b/components/engine/docs/api/version-history.md index 61245e14a7..8c56a1c19f 100644 --- a/components/engine/docs/api/version-history.md +++ b/components/engine/docs/api/version-history.md @@ -13,6 +13,12 @@ keywords: "API, Docker, rcli, REST, documentation" will be rejected. --> +## V1.38 API changes + +* `GET /tasks` and `GET /tasks/{id}` now return a `NetworkAttachmentSpec` field, + containing the `ContainerID` for non-service containers connected to "attachable" + swarm-scoped networks. + ## v1.37 API changes [Docker Engine API v1.37](https://docs.docker.com/engine/api/v1.37/) documentation From 7a450d43c00beeef2bdd624aeaa0f69b06a15224 Mon Sep 17 00:00:00 2001 From: Brian Goff Date: Wed, 23 May 2018 10:05:06 -0400 Subject: [PATCH 3/7] Bump continuity Fixes an issue where `CopyDir` would truncate files larger than 2^32 bytes. Signed-off-by: Brian Goff Upstream-commit: 616fa9446e49502da501a7d0f92b13191f5058dd Component: engine --- components/engine/vendor.conf | 2 +- .../containerd/continuity/fs/copy.go | 6 +- .../containerd/continuity/fs/copy_linux.go | 30 +++-- .../containerd/continuity/sysx/xattr_linux.go | 35 ++---- .../continuity/sysx/xattr_linux_386.go | 111 ------------------ .../continuity/sysx/xattr_linux_amd64.go | 111 ------------------ .../continuity/sysx/xattr_linux_arm.go | 111 ------------------ .../continuity/sysx/xattr_linux_arm64.go | 111 ------------------ .../continuity/sysx/xattr_linux_ppc64.go | 111 ------------------ .../continuity/sysx/xattr_linux_ppc64le.go | 111 ------------------ .../continuity/sysx/xattr_linux_s390x.go | 111 ------------------ 11 files changed, 32 insertions(+), 818 deletions(-) delete mode 100644 components/engine/vendor/github.com/containerd/continuity/sysx/xattr_linux_386.go delete mode 100644 components/engine/vendor/github.com/containerd/continuity/sysx/xattr_linux_amd64.go delete mode 100644 components/engine/vendor/github.com/containerd/continuity/sysx/xattr_linux_arm.go delete mode 100644 components/engine/vendor/github.com/containerd/continuity/sysx/xattr_linux_arm64.go delete mode 100644 components/engine/vendor/github.com/containerd/continuity/sysx/xattr_linux_ppc64.go delete mode 100644 components/engine/vendor/github.com/containerd/continuity/sysx/xattr_linux_ppc64le.go delete mode 100644 components/engine/vendor/github.com/containerd/continuity/sysx/xattr_linux_s390x.go diff --git a/components/engine/vendor.conf b/components/engine/vendor.conf index 83695a31a0..9d4e5f9124 100644 --- a/components/engine/vendor.conf +++ b/components/engine/vendor.conf @@ -110,7 +110,7 @@ google.golang.org/genproto d80a6e20e776b0b17a324d0ba1ab50a39c8e8944 # containerd github.com/containerd/containerd 4ac4fd0b6a268fe6f38b2b2e32e40daa7e424fac github.com/containerd/fifo fbfb6a11ec671efbe94ad1c12c2e98773f19e1e6 -github.com/containerd/continuity d8fb8589b0e8e85b8c8bbaa8840226d0dfeb7371 +github.com/containerd/continuity 2d3749b4da569ac97ca63dccba5eee4f5ee2beab github.com/containerd/cgroups fe281dd265766145e943a034aa41086474ea6130 github.com/containerd/console 2748ece16665b45a47f884001d5831ec79703880 github.com/containerd/go-runc 4f6e87ae043f859a38255247b49c9abc262d002f diff --git a/components/engine/vendor/github.com/containerd/continuity/fs/copy.go b/components/engine/vendor/github.com/containerd/continuity/fs/copy.go index e8f452819b..2ac474b926 100644 --- a/components/engine/vendor/github.com/containerd/continuity/fs/copy.go +++ b/components/engine/vendor/github.com/containerd/continuity/fs/copy.go @@ -72,7 +72,7 @@ func copyDirectory(dst, src string, inodes map[uint64]string) error { if err := os.Link(link, target); err != nil { return errors.Wrap(err, "failed to create hard link") } - } else if err := copyFile(source, target); err != nil { + } else if err := CopyFile(target, source); err != nil { return errors.Wrap(err, "failed to copy files") } case (fi.Mode() & os.ModeSymlink) == os.ModeSymlink: @@ -103,7 +103,9 @@ func copyDirectory(dst, src string, inodes map[uint64]string) error { return nil } -func copyFile(source, target string) error { +// CopyFile copies the source file to the target. +// The most efficient means of copying is used for the platform. +func CopyFile(target, source string) error { src, err := os.Open(source) if err != nil { return errors.Wrapf(err, "failed to open source %s", source) diff --git a/components/engine/vendor/github.com/containerd/continuity/fs/copy_linux.go b/components/engine/vendor/github.com/containerd/continuity/fs/copy_linux.go index cfab6756b8..b244e3185b 100644 --- a/components/engine/vendor/github.com/containerd/continuity/fs/copy_linux.go +++ b/components/engine/vendor/github.com/containerd/continuity/fs/copy_linux.go @@ -49,20 +49,26 @@ func copyFileContent(dst, src *os.File) error { return errors.Wrap(err, "unable to stat source") } - n, err := unix.CopyFileRange(int(src.Fd()), nil, int(dst.Fd()), nil, int(st.Size()), 0) - if err != nil { - if err != unix.ENOSYS && err != unix.EXDEV { - return errors.Wrap(err, "copy file range failed") + size := st.Size() + first := true + srcFd := int(src.Fd()) + dstFd := int(dst.Fd()) + + for size > 0 { + n, err := unix.CopyFileRange(srcFd, nil, dstFd, nil, int(size), 0) + if err != nil { + if (err != unix.ENOSYS && err != unix.EXDEV) || !first { + return errors.Wrap(err, "copy file range failed") + } + + buf := bufferPool.Get().(*[]byte) + _, err = io.CopyBuffer(dst, src, *buf) + bufferPool.Put(buf) + return errors.Wrap(err, "userspace copy failed") } - buf := bufferPool.Get().(*[]byte) - _, err = io.CopyBuffer(dst, src, *buf) - bufferPool.Put(buf) - return err - } - - if int64(n) != st.Size() { - return errors.Wrapf(err, "short copy: %d of %d", int64(n), st.Size()) + first = false + size -= int64(n) } return nil diff --git a/components/engine/vendor/github.com/containerd/continuity/sysx/xattr_linux.go b/components/engine/vendor/github.com/containerd/continuity/sysx/xattr_linux.go index cd18136343..311b896d9e 100644 --- a/components/engine/vendor/github.com/containerd/continuity/sysx/xattr_linux.go +++ b/components/engine/vendor/github.com/containerd/continuity/sysx/xattr_linux.go @@ -1,61 +1,44 @@ package sysx -import "syscall" - -// These functions will be generated by generate.sh -// $ GOOS=linux GOARCH=386 ./generate.sh xattr -// $ GOOS=linux GOARCH=amd64 ./generate.sh xattr -// $ GOOS=linux GOARCH=arm ./generate.sh xattr -// $ GOOS=linux GOARCH=arm64 ./generate.sh xattr -// $ GOOS=linux GOARCH=ppc64 ./generate.sh xattr -// $ GOOS=linux GOARCH=ppc64le ./generate.sh xattr -// $ GOOS=linux GOARCH=s390x ./generate.sh xattr +import "golang.org/x/sys/unix" // Listxattr calls syscall listxattr and reads all content // and returns a string array func Listxattr(path string) ([]string, error) { - return listxattrAll(path, syscall.Listxattr) + return listxattrAll(path, unix.Listxattr) } // Removexattr calls syscall removexattr func Removexattr(path string, attr string) (err error) { - return syscall.Removexattr(path, attr) + return unix.Removexattr(path, attr) } // Setxattr calls syscall setxattr func Setxattr(path string, attr string, data []byte, flags int) (err error) { - return syscall.Setxattr(path, attr, data, flags) + return unix.Setxattr(path, attr, data, flags) } // Getxattr calls syscall getxattr func Getxattr(path, attr string) ([]byte, error) { - return getxattrAll(path, attr, syscall.Getxattr) + return getxattrAll(path, attr, unix.Getxattr) } -//sys llistxattr(path string, dest []byte) (sz int, err error) - // LListxattr lists xattrs, not following symlinks func LListxattr(path string) ([]string, error) { - return listxattrAll(path, llistxattr) + return listxattrAll(path, unix.Llistxattr) } -//sys lremovexattr(path string, attr string) (err error) - // LRemovexattr removes an xattr, not following symlinks func LRemovexattr(path string, attr string) (err error) { - return lremovexattr(path, attr) + return unix.Lremovexattr(path, attr) } -//sys lsetxattr(path string, attr string, data []byte, flags int) (err error) - // LSetxattr sets an xattr, not following symlinks func LSetxattr(path string, attr string, data []byte, flags int) (err error) { - return lsetxattr(path, attr, data, flags) + return unix.Lsetxattr(path, attr, data, flags) } -//sys lgetxattr(path string, attr string, dest []byte) (sz int, err error) - // LGetxattr gets an xattr, not following symlinks func LGetxattr(path, attr string) ([]byte, error) { - return getxattrAll(path, attr, lgetxattr) + return getxattrAll(path, attr, unix.Lgetxattr) } diff --git a/components/engine/vendor/github.com/containerd/continuity/sysx/xattr_linux_386.go b/components/engine/vendor/github.com/containerd/continuity/sysx/xattr_linux_386.go deleted file mode 100644 index c3e5c8e385..0000000000 --- a/components/engine/vendor/github.com/containerd/continuity/sysx/xattr_linux_386.go +++ /dev/null @@ -1,111 +0,0 @@ -// mksyscall.pl -l32 xattr_linux.go -// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT - -package sysx - -import ( - "syscall" - "unsafe" -) - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func llistxattr(path string, dest []byte) (sz int, err error) { - var _p0 *byte - _p0, err = syscall.BytePtrFromString(path) - if err != nil { - return - } - var _p1 unsafe.Pointer - if len(dest) > 0 { - _p1 = unsafe.Pointer(&dest[0]) - } else { - _p1 = unsafe.Pointer(&_zero) - } - r0, _, e1 := syscall.Syscall(syscall.SYS_LLISTXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(dest))) - use(unsafe.Pointer(_p0)) - sz = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func lremovexattr(path string, attr string) (err error) { - var _p0 *byte - _p0, err = syscall.BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = syscall.BytePtrFromString(attr) - if err != nil { - return - } - _, _, e1 := syscall.Syscall(syscall.SYS_LREMOVEXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) - use(unsafe.Pointer(_p0)) - use(unsafe.Pointer(_p1)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func lsetxattr(path string, attr string, data []byte, flags int) (err error) { - var _p0 *byte - _p0, err = syscall.BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = syscall.BytePtrFromString(attr) - if err != nil { - return - } - var _p2 unsafe.Pointer - if len(data) > 0 { - _p2 = unsafe.Pointer(&data[0]) - } else { - _p2 = unsafe.Pointer(&_zero) - } - _, _, e1 := syscall.Syscall6(syscall.SYS_LSETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(_p2), uintptr(len(data)), uintptr(flags), 0) - use(unsafe.Pointer(_p0)) - use(unsafe.Pointer(_p1)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func lgetxattr(path string, attr string, dest []byte) (sz int, err error) { - var _p0 *byte - _p0, err = syscall.BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = syscall.BytePtrFromString(attr) - if err != nil { - return - } - var _p2 unsafe.Pointer - if len(dest) > 0 { - _p2 = unsafe.Pointer(&dest[0]) - } else { - _p2 = unsafe.Pointer(&_zero) - } - r0, _, e1 := syscall.Syscall6(syscall.SYS_LGETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(_p2), uintptr(len(dest)), 0, 0) - use(unsafe.Pointer(_p0)) - use(unsafe.Pointer(_p1)) - sz = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} diff --git a/components/engine/vendor/github.com/containerd/continuity/sysx/xattr_linux_amd64.go b/components/engine/vendor/github.com/containerd/continuity/sysx/xattr_linux_amd64.go deleted file mode 100644 index dec46faaaf..0000000000 --- a/components/engine/vendor/github.com/containerd/continuity/sysx/xattr_linux_amd64.go +++ /dev/null @@ -1,111 +0,0 @@ -// mksyscall.pl xattr_linux.go -// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT - -package sysx - -import ( - "syscall" - "unsafe" -) - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func llistxattr(path string, dest []byte) (sz int, err error) { - var _p0 *byte - _p0, err = syscall.BytePtrFromString(path) - if err != nil { - return - } - var _p1 unsafe.Pointer - if len(dest) > 0 { - _p1 = unsafe.Pointer(&dest[0]) - } else { - _p1 = unsafe.Pointer(&_zero) - } - r0, _, e1 := syscall.Syscall(syscall.SYS_LLISTXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(dest))) - use(unsafe.Pointer(_p0)) - sz = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func lremovexattr(path string, attr string) (err error) { - var _p0 *byte - _p0, err = syscall.BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = syscall.BytePtrFromString(attr) - if err != nil { - return - } - _, _, e1 := syscall.Syscall(syscall.SYS_LREMOVEXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) - use(unsafe.Pointer(_p0)) - use(unsafe.Pointer(_p1)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func lsetxattr(path string, attr string, data []byte, flags int) (err error) { - var _p0 *byte - _p0, err = syscall.BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = syscall.BytePtrFromString(attr) - if err != nil { - return - } - var _p2 unsafe.Pointer - if len(data) > 0 { - _p2 = unsafe.Pointer(&data[0]) - } else { - _p2 = unsafe.Pointer(&_zero) - } - _, _, e1 := syscall.Syscall6(syscall.SYS_LSETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(_p2), uintptr(len(data)), uintptr(flags), 0) - use(unsafe.Pointer(_p0)) - use(unsafe.Pointer(_p1)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func lgetxattr(path string, attr string, dest []byte) (sz int, err error) { - var _p0 *byte - _p0, err = syscall.BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = syscall.BytePtrFromString(attr) - if err != nil { - return - } - var _p2 unsafe.Pointer - if len(dest) > 0 { - _p2 = unsafe.Pointer(&dest[0]) - } else { - _p2 = unsafe.Pointer(&_zero) - } - r0, _, e1 := syscall.Syscall6(syscall.SYS_LGETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(_p2), uintptr(len(dest)), 0, 0) - use(unsafe.Pointer(_p0)) - use(unsafe.Pointer(_p1)) - sz = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} diff --git a/components/engine/vendor/github.com/containerd/continuity/sysx/xattr_linux_arm.go b/components/engine/vendor/github.com/containerd/continuity/sysx/xattr_linux_arm.go deleted file mode 100644 index c3e5c8e385..0000000000 --- a/components/engine/vendor/github.com/containerd/continuity/sysx/xattr_linux_arm.go +++ /dev/null @@ -1,111 +0,0 @@ -// mksyscall.pl -l32 xattr_linux.go -// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT - -package sysx - -import ( - "syscall" - "unsafe" -) - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func llistxattr(path string, dest []byte) (sz int, err error) { - var _p0 *byte - _p0, err = syscall.BytePtrFromString(path) - if err != nil { - return - } - var _p1 unsafe.Pointer - if len(dest) > 0 { - _p1 = unsafe.Pointer(&dest[0]) - } else { - _p1 = unsafe.Pointer(&_zero) - } - r0, _, e1 := syscall.Syscall(syscall.SYS_LLISTXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(dest))) - use(unsafe.Pointer(_p0)) - sz = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func lremovexattr(path string, attr string) (err error) { - var _p0 *byte - _p0, err = syscall.BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = syscall.BytePtrFromString(attr) - if err != nil { - return - } - _, _, e1 := syscall.Syscall(syscall.SYS_LREMOVEXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) - use(unsafe.Pointer(_p0)) - use(unsafe.Pointer(_p1)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func lsetxattr(path string, attr string, data []byte, flags int) (err error) { - var _p0 *byte - _p0, err = syscall.BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = syscall.BytePtrFromString(attr) - if err != nil { - return - } - var _p2 unsafe.Pointer - if len(data) > 0 { - _p2 = unsafe.Pointer(&data[0]) - } else { - _p2 = unsafe.Pointer(&_zero) - } - _, _, e1 := syscall.Syscall6(syscall.SYS_LSETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(_p2), uintptr(len(data)), uintptr(flags), 0) - use(unsafe.Pointer(_p0)) - use(unsafe.Pointer(_p1)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func lgetxattr(path string, attr string, dest []byte) (sz int, err error) { - var _p0 *byte - _p0, err = syscall.BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = syscall.BytePtrFromString(attr) - if err != nil { - return - } - var _p2 unsafe.Pointer - if len(dest) > 0 { - _p2 = unsafe.Pointer(&dest[0]) - } else { - _p2 = unsafe.Pointer(&_zero) - } - r0, _, e1 := syscall.Syscall6(syscall.SYS_LGETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(_p2), uintptr(len(dest)), 0, 0) - use(unsafe.Pointer(_p0)) - use(unsafe.Pointer(_p1)) - sz = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} diff --git a/components/engine/vendor/github.com/containerd/continuity/sysx/xattr_linux_arm64.go b/components/engine/vendor/github.com/containerd/continuity/sysx/xattr_linux_arm64.go deleted file mode 100644 index dec46faaaf..0000000000 --- a/components/engine/vendor/github.com/containerd/continuity/sysx/xattr_linux_arm64.go +++ /dev/null @@ -1,111 +0,0 @@ -// mksyscall.pl xattr_linux.go -// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT - -package sysx - -import ( - "syscall" - "unsafe" -) - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func llistxattr(path string, dest []byte) (sz int, err error) { - var _p0 *byte - _p0, err = syscall.BytePtrFromString(path) - if err != nil { - return - } - var _p1 unsafe.Pointer - if len(dest) > 0 { - _p1 = unsafe.Pointer(&dest[0]) - } else { - _p1 = unsafe.Pointer(&_zero) - } - r0, _, e1 := syscall.Syscall(syscall.SYS_LLISTXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(dest))) - use(unsafe.Pointer(_p0)) - sz = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func lremovexattr(path string, attr string) (err error) { - var _p0 *byte - _p0, err = syscall.BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = syscall.BytePtrFromString(attr) - if err != nil { - return - } - _, _, e1 := syscall.Syscall(syscall.SYS_LREMOVEXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) - use(unsafe.Pointer(_p0)) - use(unsafe.Pointer(_p1)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func lsetxattr(path string, attr string, data []byte, flags int) (err error) { - var _p0 *byte - _p0, err = syscall.BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = syscall.BytePtrFromString(attr) - if err != nil { - return - } - var _p2 unsafe.Pointer - if len(data) > 0 { - _p2 = unsafe.Pointer(&data[0]) - } else { - _p2 = unsafe.Pointer(&_zero) - } - _, _, e1 := syscall.Syscall6(syscall.SYS_LSETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(_p2), uintptr(len(data)), uintptr(flags), 0) - use(unsafe.Pointer(_p0)) - use(unsafe.Pointer(_p1)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func lgetxattr(path string, attr string, dest []byte) (sz int, err error) { - var _p0 *byte - _p0, err = syscall.BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = syscall.BytePtrFromString(attr) - if err != nil { - return - } - var _p2 unsafe.Pointer - if len(dest) > 0 { - _p2 = unsafe.Pointer(&dest[0]) - } else { - _p2 = unsafe.Pointer(&_zero) - } - r0, _, e1 := syscall.Syscall6(syscall.SYS_LGETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(_p2), uintptr(len(dest)), 0, 0) - use(unsafe.Pointer(_p0)) - use(unsafe.Pointer(_p1)) - sz = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} diff --git a/components/engine/vendor/github.com/containerd/continuity/sysx/xattr_linux_ppc64.go b/components/engine/vendor/github.com/containerd/continuity/sysx/xattr_linux_ppc64.go deleted file mode 100644 index dec46faaaf..0000000000 --- a/components/engine/vendor/github.com/containerd/continuity/sysx/xattr_linux_ppc64.go +++ /dev/null @@ -1,111 +0,0 @@ -// mksyscall.pl xattr_linux.go -// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT - -package sysx - -import ( - "syscall" - "unsafe" -) - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func llistxattr(path string, dest []byte) (sz int, err error) { - var _p0 *byte - _p0, err = syscall.BytePtrFromString(path) - if err != nil { - return - } - var _p1 unsafe.Pointer - if len(dest) > 0 { - _p1 = unsafe.Pointer(&dest[0]) - } else { - _p1 = unsafe.Pointer(&_zero) - } - r0, _, e1 := syscall.Syscall(syscall.SYS_LLISTXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(dest))) - use(unsafe.Pointer(_p0)) - sz = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func lremovexattr(path string, attr string) (err error) { - var _p0 *byte - _p0, err = syscall.BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = syscall.BytePtrFromString(attr) - if err != nil { - return - } - _, _, e1 := syscall.Syscall(syscall.SYS_LREMOVEXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) - use(unsafe.Pointer(_p0)) - use(unsafe.Pointer(_p1)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func lsetxattr(path string, attr string, data []byte, flags int) (err error) { - var _p0 *byte - _p0, err = syscall.BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = syscall.BytePtrFromString(attr) - if err != nil { - return - } - var _p2 unsafe.Pointer - if len(data) > 0 { - _p2 = unsafe.Pointer(&data[0]) - } else { - _p2 = unsafe.Pointer(&_zero) - } - _, _, e1 := syscall.Syscall6(syscall.SYS_LSETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(_p2), uintptr(len(data)), uintptr(flags), 0) - use(unsafe.Pointer(_p0)) - use(unsafe.Pointer(_p1)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func lgetxattr(path string, attr string, dest []byte) (sz int, err error) { - var _p0 *byte - _p0, err = syscall.BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = syscall.BytePtrFromString(attr) - if err != nil { - return - } - var _p2 unsafe.Pointer - if len(dest) > 0 { - _p2 = unsafe.Pointer(&dest[0]) - } else { - _p2 = unsafe.Pointer(&_zero) - } - r0, _, e1 := syscall.Syscall6(syscall.SYS_LGETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(_p2), uintptr(len(dest)), 0, 0) - use(unsafe.Pointer(_p0)) - use(unsafe.Pointer(_p1)) - sz = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} diff --git a/components/engine/vendor/github.com/containerd/continuity/sysx/xattr_linux_ppc64le.go b/components/engine/vendor/github.com/containerd/continuity/sysx/xattr_linux_ppc64le.go deleted file mode 100644 index dec46faaaf..0000000000 --- a/components/engine/vendor/github.com/containerd/continuity/sysx/xattr_linux_ppc64le.go +++ /dev/null @@ -1,111 +0,0 @@ -// mksyscall.pl xattr_linux.go -// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT - -package sysx - -import ( - "syscall" - "unsafe" -) - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func llistxattr(path string, dest []byte) (sz int, err error) { - var _p0 *byte - _p0, err = syscall.BytePtrFromString(path) - if err != nil { - return - } - var _p1 unsafe.Pointer - if len(dest) > 0 { - _p1 = unsafe.Pointer(&dest[0]) - } else { - _p1 = unsafe.Pointer(&_zero) - } - r0, _, e1 := syscall.Syscall(syscall.SYS_LLISTXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(dest))) - use(unsafe.Pointer(_p0)) - sz = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func lremovexattr(path string, attr string) (err error) { - var _p0 *byte - _p0, err = syscall.BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = syscall.BytePtrFromString(attr) - if err != nil { - return - } - _, _, e1 := syscall.Syscall(syscall.SYS_LREMOVEXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) - use(unsafe.Pointer(_p0)) - use(unsafe.Pointer(_p1)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func lsetxattr(path string, attr string, data []byte, flags int) (err error) { - var _p0 *byte - _p0, err = syscall.BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = syscall.BytePtrFromString(attr) - if err != nil { - return - } - var _p2 unsafe.Pointer - if len(data) > 0 { - _p2 = unsafe.Pointer(&data[0]) - } else { - _p2 = unsafe.Pointer(&_zero) - } - _, _, e1 := syscall.Syscall6(syscall.SYS_LSETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(_p2), uintptr(len(data)), uintptr(flags), 0) - use(unsafe.Pointer(_p0)) - use(unsafe.Pointer(_p1)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func lgetxattr(path string, attr string, dest []byte) (sz int, err error) { - var _p0 *byte - _p0, err = syscall.BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = syscall.BytePtrFromString(attr) - if err != nil { - return - } - var _p2 unsafe.Pointer - if len(dest) > 0 { - _p2 = unsafe.Pointer(&dest[0]) - } else { - _p2 = unsafe.Pointer(&_zero) - } - r0, _, e1 := syscall.Syscall6(syscall.SYS_LGETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(_p2), uintptr(len(dest)), 0, 0) - use(unsafe.Pointer(_p0)) - use(unsafe.Pointer(_p1)) - sz = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} diff --git a/components/engine/vendor/github.com/containerd/continuity/sysx/xattr_linux_s390x.go b/components/engine/vendor/github.com/containerd/continuity/sysx/xattr_linux_s390x.go deleted file mode 100644 index dec46faaaf..0000000000 --- a/components/engine/vendor/github.com/containerd/continuity/sysx/xattr_linux_s390x.go +++ /dev/null @@ -1,111 +0,0 @@ -// mksyscall.pl xattr_linux.go -// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT - -package sysx - -import ( - "syscall" - "unsafe" -) - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func llistxattr(path string, dest []byte) (sz int, err error) { - var _p0 *byte - _p0, err = syscall.BytePtrFromString(path) - if err != nil { - return - } - var _p1 unsafe.Pointer - if len(dest) > 0 { - _p1 = unsafe.Pointer(&dest[0]) - } else { - _p1 = unsafe.Pointer(&_zero) - } - r0, _, e1 := syscall.Syscall(syscall.SYS_LLISTXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(dest))) - use(unsafe.Pointer(_p0)) - sz = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func lremovexattr(path string, attr string) (err error) { - var _p0 *byte - _p0, err = syscall.BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = syscall.BytePtrFromString(attr) - if err != nil { - return - } - _, _, e1 := syscall.Syscall(syscall.SYS_LREMOVEXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) - use(unsafe.Pointer(_p0)) - use(unsafe.Pointer(_p1)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func lsetxattr(path string, attr string, data []byte, flags int) (err error) { - var _p0 *byte - _p0, err = syscall.BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = syscall.BytePtrFromString(attr) - if err != nil { - return - } - var _p2 unsafe.Pointer - if len(data) > 0 { - _p2 = unsafe.Pointer(&data[0]) - } else { - _p2 = unsafe.Pointer(&_zero) - } - _, _, e1 := syscall.Syscall6(syscall.SYS_LSETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(_p2), uintptr(len(data)), uintptr(flags), 0) - use(unsafe.Pointer(_p0)) - use(unsafe.Pointer(_p1)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func lgetxattr(path string, attr string, dest []byte) (sz int, err error) { - var _p0 *byte - _p0, err = syscall.BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = syscall.BytePtrFromString(attr) - if err != nil { - return - } - var _p2 unsafe.Pointer - if len(dest) > 0 { - _p2 = unsafe.Pointer(&dest[0]) - } else { - _p2 = unsafe.Pointer(&_zero) - } - r0, _, e1 := syscall.Syscall6(syscall.SYS_LGETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(_p2), uintptr(len(dest)), 0, 0) - use(unsafe.Pointer(_p0)) - use(unsafe.Pointer(_p1)) - sz = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} From 0f96e98e12225c6622c25f6103d314de8557a4cf Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Sat, 19 May 2018 13:38:54 +0200 Subject: [PATCH 4/7] Various code-cleanup remove unnescessary import aliases, brackets, and so on. Signed-off-by: Sebastiaan van Stijn Upstream-commit: f23c00d8701e4bd0f2372a586dacbf66a26f9a51 Component: engine --- components/engine/api/common.go | 4 ++-- components/engine/api/common_unix.go | 2 +- .../api/server/router/build/build_routes.go | 2 +- components/engine/api/server/server_test.go | 3 +-- components/engine/api/types/client.go | 2 +- components/engine/builder/builder.go | 2 +- .../engine/builder/dockerfile/buildargs.go | 2 +- components/engine/builder/dockerfile/builder.go | 2 +- .../builder/dockerfile/instructions/commands.go | 1 - .../dockerfile/instructions/support_test.go | 2 +- .../engine/builder/dockerfile/parser/parser.go | 3 +-- .../engine/builder/dockerfile/shell/lex_test.go | 2 +- .../engine/builder/remotecontext/tarsum.go | 2 +- components/engine/cli/cobra.go | 4 ++-- components/engine/client/container_wait_test.go | 3 +-- components/engine/client/errors.go | 1 - components/engine/client/image_save_test.go | 3 +-- components/engine/client/node_remove.go | 3 +-- components/engine/client/node_remove_test.go | 3 +-- components/engine/client/plugin_remove_test.go | 3 +-- components/engine/client/request_test.go | 2 +- components/engine/client/service_create.go | 2 +- components/engine/cmd/dockerd/config_unix.go | 2 +- components/engine/cmd/dockerd/metrics.go | 2 +- components/engine/container/view.go | 2 +- .../engine/daemon/cluster/convert/container.go | 2 +- .../cluster/executor/container/container_test.go | 2 +- components/engine/daemon/config/config_unix.go | 2 +- .../engine/daemon/config/config_unix_test.go | 2 +- components/engine/daemon/daemon_unix.go | 6 +++--- components/engine/daemon/exec.go | 2 +- .../engine/daemon/graphdriver/aufs/dirs.go | 4 ++-- .../daemon/graphdriver/devmapper/deviceset.go | 6 +++--- .../daemon/graphdriver/devmapper/driver.go | 2 +- .../graphdriver/graphtest/graphtest_unix.go | 2 +- .../daemon/graphdriver/graphtest/testutil.go | 2 +- .../engine/daemon/graphdriver/vfs/driver.go | 2 +- components/engine/daemon/graphdriver/zfs/zfs.go | 2 +- components/engine/daemon/images/image_delete.go | 4 ++-- components/engine/daemon/images/image_prune.go | 2 +- components/engine/daemon/images/locals.go | 2 +- components/engine/daemon/logger/adapter.go | 2 +- .../daemon/logger/awslogs/cloudwatchlogs_test.go | 2 +- components/engine/daemon/logger/factory.go | 2 +- .../engine/daemon/logger/gcplogs/gcplogging.go | 3 +-- .../daemon/logger/jsonfilelog/jsonfilelog.go | 2 +- .../loggerutils/multireader/multireader_test.go | 2 +- components/engine/daemon/metrics.go | 2 +- components/engine/daemon/metrics_unix.go | 4 ++-- components/engine/daemon/oci_linux.go | 2 +- components/engine/daemon/reload_test.go | 2 +- components/engine/daemon/update_linux.go | 2 +- components/engine/distribution/errors_test.go | 2 +- components/engine/distribution/pull_v2.go | 2 +- components/engine/distribution/push_v2.go | 2 +- components/engine/dockerversion/version_lib.go | 16 ++++++++-------- .../agent/master/set_test.go | 4 ++-- components/engine/image/tarexport/load.go | 2 +- .../integration-cli/docker_api_build_test.go | 2 +- .../integration-cli/docker_api_network_test.go | 4 ++-- .../integration-cli/docker_cli_build_test.go | 6 +++--- .../docker_cli_build_unix_test.go | 2 +- .../integration-cli/docker_cli_create_test.go | 16 ++++++++-------- .../integration-cli/docker_cli_daemon_test.go | 11 +++++------ .../integration-cli/docker_cli_exec_test.go | 2 +- .../docker_cli_network_unix_test.go | 12 ++++++------ .../engine/integration-cli/docker_cli_ps_test.go | 4 ++-- .../docker_cli_pull_local_test.go | 6 +++--- .../integration-cli/docker_cli_push_test.go | 2 +- .../integration-cli/docker_cli_save_load_test.go | 6 +++--- .../integration-cli/docker_cli_sni_test.go | 2 +- .../integration-cli/environment/environment.go | 1 - components/engine/integration-cli/utils_test.go | 4 ++-- .../engine/integration/build/build_test.go | 2 +- .../engine/integration/config/config_test.go | 2 +- .../engine/integration/container/pause_test.go | 4 ++-- .../engine/integration/container/ps_test.go | 2 +- .../engine/integration/network/service_test.go | 4 ++-- .../engine/integration/secret/secret_test.go | 2 +- .../engine/internal/test/environment/protect.go | 12 ++++++------ .../engine/libcontainerd/client_daemon_linux.go | 2 +- components/engine/libcontainerd/types_linux.go | 2 +- components/engine/migrate/v1/migratev1.go | 3 +-- components/engine/oci/devices_linux.go | 2 +- components/engine/oci/namespaces.go | 2 +- components/engine/opts/address_pools.go | 2 +- components/engine/opts/opts.go | 10 +++++----- .../engine/pkg/archive/changes_posix_test.go | 2 +- components/engine/pkg/archive/time_linux.go | 2 +- .../engine/pkg/broadcaster/unbuffered_test.go | 1 - .../engine/pkg/devicemapper/devmapper_wrapper.go | 2 +- components/engine/pkg/idtools/idtools.go | 4 ++-- components/engine/pkg/jsonmessage/jsonmessage.go | 4 ++-- components/engine/pkg/pubsub/publisher_test.go | 8 ++++---- components/engine/pkg/signal/signal.go | 2 +- components/engine/pkg/term/windows/windows.go | 2 +- .../engine/pkg/truncindex/truncindex_test.go | 2 +- components/engine/plugin/backend_linux.go | 2 +- components/engine/plugin/defs.go | 2 +- .../executor/containerd/containerd_test.go | 2 +- components/engine/plugin/manager.go | 2 +- components/engine/plugin/manager_linux_test.go | 2 +- components/engine/plugin/store.go | 6 +++--- components/engine/plugin/v2/plugin.go | 2 +- components/engine/plugin/v2/plugin_linux.go | 2 +- components/engine/reference/store_test.go | 2 +- components/engine/registry/config_test.go | 2 +- components/engine/registry/endpoint_v1.go | 2 +- components/engine/registry/registry_mock_test.go | 2 +- components/engine/registry/registry_test.go | 2 +- components/engine/registry/session.go | 2 +- components/engine/volume/local/local.go | 2 +- 112 files changed, 168 insertions(+), 182 deletions(-) diff --git a/components/engine/api/common.go b/components/engine/api/common.go index beb251a989..4a0a5d5832 100644 --- a/components/engine/api/common.go +++ b/components/engine/api/common.go @@ -3,9 +3,9 @@ package api // import "github.com/docker/docker/api" // Common constants for daemon and client. const ( // DefaultVersion of Current REST API - DefaultVersion string = "1.37" + DefaultVersion = "1.37" // NoBaseImageSpecifier is the symbol used by the FROM // command to specify that no base image is to be used. - NoBaseImageSpecifier string = "scratch" + NoBaseImageSpecifier = "scratch" ) diff --git a/components/engine/api/common_unix.go b/components/engine/api/common_unix.go index af1a541646..504b0c90d7 100644 --- a/components/engine/api/common_unix.go +++ b/components/engine/api/common_unix.go @@ -3,4 +3,4 @@ package api // import "github.com/docker/docker/api" // MinVersion represents Minimum REST API version supported -const MinVersion string = "1.12" +const MinVersion = "1.12" diff --git a/components/engine/api/server/router/build/build_routes.go b/components/engine/api/server/router/build/build_routes.go index 1261cf4777..3e3668c42b 100644 --- a/components/engine/api/server/router/build/build_routes.go +++ b/components/engine/api/server/router/build/build_routes.go @@ -23,7 +23,7 @@ import ( "github.com/docker/docker/pkg/progress" "github.com/docker/docker/pkg/streamformatter" "github.com/docker/docker/pkg/system" - units "github.com/docker/go-units" + "github.com/docker/go-units" "github.com/pkg/errors" "github.com/sirupsen/logrus" ) diff --git a/components/engine/api/server/server_test.go b/components/engine/api/server/server_test.go index 3fbe1c9d13..e0fac30ab7 100644 --- a/components/engine/api/server/server_test.go +++ b/components/engine/api/server/server_test.go @@ -1,13 +1,12 @@ package server // import "github.com/docker/docker/api/server" import ( + "context" "net/http" "net/http/httptest" "strings" "testing" - "context" - "github.com/docker/docker/api" "github.com/docker/docker/api/server/httputils" "github.com/docker/docker/api/server/middleware" diff --git a/components/engine/api/types/client.go b/components/engine/api/types/client.go index 18b36d592b..3d2e057c9a 100644 --- a/components/engine/api/types/client.go +++ b/components/engine/api/types/client.go @@ -7,7 +7,7 @@ import ( "github.com/docker/docker/api/types/container" "github.com/docker/docker/api/types/filters" - units "github.com/docker/go-units" + "github.com/docker/go-units" ) // CheckpointCreateOptions holds parameters to create a checkpoint from a container diff --git a/components/engine/builder/builder.go b/components/engine/builder/builder.go index 3c5edb0679..3eb0341417 100644 --- a/components/engine/builder/builder.go +++ b/components/engine/builder/builder.go @@ -19,7 +19,7 @@ import ( const ( // DefaultDockerfileName is the Default filename with Docker commands, read by docker build - DefaultDockerfileName string = "Dockerfile" + DefaultDockerfileName = "Dockerfile" ) // Source defines a location that can be used as a source for the ADD/COPY diff --git a/components/engine/builder/dockerfile/buildargs.go b/components/engine/builder/dockerfile/buildargs.go index 232f9d23f6..f9cceaa05c 100644 --- a/components/engine/builder/dockerfile/buildargs.go +++ b/components/engine/builder/dockerfile/buildargs.go @@ -69,7 +69,7 @@ func (b *BuildArgs) MergeReferencedArgs(other *BuildArgs) { // WarnOnUnusedBuildArgs checks if there are any leftover build-args that were // passed but not consumed during build. Print a warning, if there are any. func (b *BuildArgs) WarnOnUnusedBuildArgs(out io.Writer) { - leftoverArgs := []string{} + var leftoverArgs []string for arg := range b.argsFromOptions { _, isReferenced := b.referencedArgs[arg] _, isBuiltin := builtinAllowedBuildArgs[arg] diff --git a/components/engine/builder/dockerfile/builder.go b/components/engine/builder/dockerfile/builder.go index 1455fd966e..890e7b89fd 100644 --- a/components/engine/builder/dockerfile/builder.go +++ b/components/engine/builder/dockerfile/builder.go @@ -387,7 +387,7 @@ func BuildFromConfig(config *container.Config, changes []string, os string) (*co b.Stderr = ioutil.Discard b.disableCommit = true - commands := []instructions.Command{} + var commands []instructions.Command for _, n := range dockerfile.AST.Children { cmd, err := instructions.ParseCommand(n) if err != nil { diff --git a/components/engine/builder/dockerfile/instructions/commands.go b/components/engine/builder/dockerfile/instructions/commands.go index 633a2b3fc7..96d33016b5 100644 --- a/components/engine/builder/dockerfile/instructions/commands.go +++ b/components/engine/builder/dockerfile/instructions/commands.go @@ -2,7 +2,6 @@ package instructions // import "github.com/docker/docker/builder/dockerfile/inst import ( "errors" - "strings" "github.com/docker/docker/api/types/container" diff --git a/components/engine/builder/dockerfile/instructions/support_test.go b/components/engine/builder/dockerfile/instructions/support_test.go index 5c79e383db..0332c524e8 100644 --- a/components/engine/builder/dockerfile/instructions/support_test.go +++ b/components/engine/builder/dockerfile/instructions/support_test.go @@ -10,7 +10,7 @@ type testCase struct { } func initTestCases() []testCase { - testCases := []testCase{} + var testCases []testCase testCases = append(testCases, testCase{ name: "empty args", diff --git a/components/engine/builder/dockerfile/parser/parser.go b/components/engine/builder/dockerfile/parser/parser.go index b065b8a4ea..f938b808b6 100644 --- a/components/engine/builder/dockerfile/parser/parser.go +++ b/components/engine/builder/dockerfile/parser/parser.go @@ -262,8 +262,7 @@ func Parse(rwc io.Reader) (*Result, error) { } if hasEmptyContinuationLine { - warning := "[WARNING]: Empty continuation line found in:\n " + line - warnings = append(warnings, warning) + warnings = append(warnings, "[WARNING]: Empty continuation line found in:\n "+line) } child, err := newNodeFromLine(line, d) diff --git a/components/engine/builder/dockerfile/shell/lex_test.go b/components/engine/builder/dockerfile/shell/lex_test.go index 7a726ad79b..f38da2026f 100644 --- a/components/engine/builder/dockerfile/shell/lex_test.go +++ b/components/engine/builder/dockerfile/shell/lex_test.go @@ -71,8 +71,8 @@ func TestShellParser4Words(t *testing.T) { } defer file.Close() + var envs []string shlex := NewLex('\\') - envs := []string{} scanner := bufio.NewScanner(file) lineNum := 0 for scanner.Scan() { diff --git a/components/engine/builder/remotecontext/tarsum.go b/components/engine/builder/remotecontext/tarsum.go index 9e8c7d6072..b809cfb78b 100644 --- a/components/engine/builder/remotecontext/tarsum.go +++ b/components/engine/builder/remotecontext/tarsum.go @@ -6,7 +6,7 @@ import ( "github.com/docker/docker/pkg/containerfs" iradix "github.com/hashicorp/go-immutable-radix" - digest "github.com/opencontainers/go-digest" + "github.com/opencontainers/go-digest" "github.com/pkg/errors" "github.com/tonistiigi/fsutil" ) diff --git a/components/engine/cli/cobra.go b/components/engine/cli/cobra.go index 7c4196e141..8ed1fddc06 100644 --- a/components/engine/cli/cobra.go +++ b/components/engine/cli/cobra.go @@ -51,7 +51,7 @@ func hasManagementSubCommands(cmd *cobra.Command) bool { } func operationSubCommands(cmd *cobra.Command) []*cobra.Command { - cmds := []*cobra.Command{} + var cmds []*cobra.Command for _, sub := range cmd.Commands() { if sub.IsAvailableCommand() && !sub.HasSubCommands() { cmds = append(cmds, sub) @@ -69,7 +69,7 @@ func wrappedFlagUsages(cmd *cobra.Command) string { } func managementSubCommands(cmd *cobra.Command) []*cobra.Command { - cmds := []*cobra.Command{} + var cmds []*cobra.Command for _, sub := range cmd.Commands() { if sub.IsAvailableCommand() && sub.HasSubCommands() { cmds = append(cmds, sub) diff --git a/components/engine/client/container_wait_test.go b/components/engine/client/container_wait_test.go index e18e1376f1..11a9203ddc 100644 --- a/components/engine/client/container_wait_test.go +++ b/components/engine/client/container_wait_test.go @@ -2,6 +2,7 @@ package client // import "github.com/docker/docker/client" import ( "bytes" + "context" "encoding/json" "fmt" "io/ioutil" @@ -11,8 +12,6 @@ import ( "testing" "time" - "context" - "github.com/docker/docker/api/types/container" ) diff --git a/components/engine/client/errors.go b/components/engine/client/errors.go index 05c1246276..0461af329d 100644 --- a/components/engine/client/errors.go +++ b/components/engine/client/errors.go @@ -2,7 +2,6 @@ package client // import "github.com/docker/docker/client" import ( "fmt" - "net/http" "github.com/docker/docker/api/types/versions" diff --git a/components/engine/client/image_save_test.go b/components/engine/client/image_save_test.go index f79efc654d..a40055e583 100644 --- a/components/engine/client/image_save_test.go +++ b/components/engine/client/image_save_test.go @@ -7,9 +7,8 @@ import ( "io/ioutil" "net/http" "reflect" - "testing" - "strings" + "testing" ) func TestImageSaveError(t *testing.T) { diff --git a/components/engine/client/node_remove.go b/components/engine/client/node_remove.go index c07fc0eb39..e7a7505715 100644 --- a/components/engine/client/node_remove.go +++ b/components/engine/client/node_remove.go @@ -1,9 +1,8 @@ package client // import "github.com/docker/docker/client" import ( - "net/url" - "context" + "net/url" "github.com/docker/docker/api/types" ) diff --git a/components/engine/client/node_remove_test.go b/components/engine/client/node_remove_test.go index d30e718db1..85f828b849 100644 --- a/components/engine/client/node_remove_test.go +++ b/components/engine/client/node_remove_test.go @@ -2,14 +2,13 @@ package client // import "github.com/docker/docker/client" import ( "bytes" + "context" "fmt" "io/ioutil" "net/http" "strings" "testing" - "context" - "github.com/docker/docker/api/types" ) diff --git a/components/engine/client/plugin_remove_test.go b/components/engine/client/plugin_remove_test.go index a037ae2a13..e6c76342ee 100644 --- a/components/engine/client/plugin_remove_test.go +++ b/components/engine/client/plugin_remove_test.go @@ -2,14 +2,13 @@ package client // import "github.com/docker/docker/client" import ( "bytes" + "context" "fmt" "io/ioutil" "net/http" "strings" "testing" - "context" - "github.com/docker/docker/api/types" ) diff --git a/components/engine/client/request_test.go b/components/engine/client/request_test.go index 704a122c08..e45a8651a0 100644 --- a/components/engine/client/request_test.go +++ b/components/engine/client/request_test.go @@ -61,7 +61,7 @@ func TestSetHostHeader(t *testing.T) { } return &http.Response{ StatusCode: http.StatusOK, - Body: ioutil.NopCloser(bytes.NewReader(([]byte("")))), + Body: ioutil.NopCloser(bytes.NewReader([]byte(""))), }, nil }), diff --git a/components/engine/client/service_create.go b/components/engine/client/service_create.go index 8d08271689..8fadda4a90 100644 --- a/components/engine/client/service_create.go +++ b/components/engine/client/service_create.go @@ -9,7 +9,7 @@ import ( "github.com/docker/distribution/reference" "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/swarm" - digest "github.com/opencontainers/go-digest" + "github.com/opencontainers/go-digest" "github.com/pkg/errors" ) diff --git a/components/engine/cmd/dockerd/config_unix.go b/components/engine/cmd/dockerd/config_unix.go index 37acd38be4..2dbd84b1db 100644 --- a/components/engine/cmd/dockerd/config_unix.go +++ b/components/engine/cmd/dockerd/config_unix.go @@ -5,7 +5,7 @@ package main import ( "github.com/docker/docker/daemon/config" "github.com/docker/docker/opts" - units "github.com/docker/go-units" + "github.com/docker/go-units" "github.com/spf13/pflag" ) diff --git a/components/engine/cmd/dockerd/metrics.go b/components/engine/cmd/dockerd/metrics.go index 99d41cb3aa..20ceaf8466 100644 --- a/components/engine/cmd/dockerd/metrics.go +++ b/components/engine/cmd/dockerd/metrics.go @@ -4,7 +4,7 @@ import ( "net" "net/http" - metrics "github.com/docker/go-metrics" + "github.com/docker/go-metrics" "github.com/sirupsen/logrus" ) diff --git a/components/engine/container/view.go b/components/engine/container/view.go index baf6fe7195..b631499412 100644 --- a/components/engine/container/view.go +++ b/components/engine/container/view.go @@ -340,7 +340,7 @@ func (v *memdbView) transform(container *Container) *Snapshot { } if len(container.Args) > 0 { - args := []string{} + var args []string for _, arg := range container.Args { if strings.Contains(arg, " ") { args = append(args, fmt.Sprintf("'%s'", arg)) diff --git a/components/engine/daemon/cluster/convert/container.go b/components/engine/daemon/cluster/convert/container.go index baf02a996c..0a34fc73e4 100644 --- a/components/engine/daemon/cluster/convert/container.go +++ b/components/engine/daemon/cluster/convert/container.go @@ -5,7 +5,7 @@ import ( "fmt" "strings" - container "github.com/docker/docker/api/types/container" + "github.com/docker/docker/api/types/container" mounttypes "github.com/docker/docker/api/types/mount" types "github.com/docker/docker/api/types/swarm" swarmapi "github.com/docker/swarmkit/api" diff --git a/components/engine/daemon/cluster/executor/container/container_test.go b/components/engine/daemon/cluster/executor/container/container_test.go index 1e94171974..f9e8c8a92e 100644 --- a/components/engine/daemon/cluster/executor/container/container_test.go +++ b/components/engine/daemon/cluster/executor/container/container_test.go @@ -3,7 +3,7 @@ package container // import "github.com/docker/docker/daemon/cluster/executor/co import ( "testing" - container "github.com/docker/docker/api/types/container" + "github.com/docker/docker/api/types/container" swarmapi "github.com/docker/swarmkit/api" "github.com/gotestyourself/gotestyourself/assert" ) diff --git a/components/engine/daemon/config/config_unix.go b/components/engine/daemon/config/config_unix.go index ee091b8bfe..1970928f9b 100644 --- a/components/engine/daemon/config/config_unix.go +++ b/components/engine/daemon/config/config_unix.go @@ -7,7 +7,7 @@ import ( containertypes "github.com/docker/docker/api/types/container" "github.com/docker/docker/opts" - units "github.com/docker/go-units" + "github.com/docker/go-units" ) const ( diff --git a/components/engine/daemon/config/config_unix_test.go b/components/engine/daemon/config/config_unix_test.go index 53eb428264..d9bb9476ac 100644 --- a/components/engine/daemon/config/config_unix_test.go +++ b/components/engine/daemon/config/config_unix_test.go @@ -6,7 +6,7 @@ import ( "testing" "github.com/docker/docker/opts" - units "github.com/docker/go-units" + "github.com/docker/go-units" "github.com/gotestyourself/gotestyourself/assert" is "github.com/gotestyourself/gotestyourself/assert/cmp" "github.com/gotestyourself/gotestyourself/fs" diff --git a/components/engine/daemon/daemon_unix.go b/components/engine/daemon/daemon_unix.go index f6f0f166bd..e2c77610d4 100644 --- a/components/engine/daemon/daemon_unix.go +++ b/components/engine/daemon/daemon_unix.go @@ -43,7 +43,7 @@ import ( lntypes "github.com/docker/libnetwork/types" "github.com/opencontainers/runc/libcontainer/cgroups" rsystem "github.com/opencontainers/runc/libcontainer/system" - specs "github.com/opencontainers/runtime-spec/specs-go" + "github.com/opencontainers/runtime-spec/specs-go" "github.com/opencontainers/selinux/go-selinux/label" "github.com/pkg/errors" "github.com/sirupsen/logrus" @@ -67,8 +67,8 @@ const ( // It's not kernel limit, we want this 4M limit to supply a reasonable functional container linuxMinMemory = 4194304 // constants for remapped root settings - defaultIDSpecifier string = "default" - defaultRemappedID string = "dockremap" + defaultIDSpecifier = "default" + defaultRemappedID = "dockremap" // constant for cgroup drivers cgroupFsDriver = "cgroupfs" diff --git a/components/engine/daemon/exec.go b/components/engine/daemon/exec.go index a279f246e6..289c6bfb30 100644 --- a/components/engine/daemon/exec.go +++ b/components/engine/daemon/exec.go @@ -16,7 +16,7 @@ import ( "github.com/docker/docker/pkg/pools" "github.com/docker/docker/pkg/signal" "github.com/docker/docker/pkg/term" - specs "github.com/opencontainers/runtime-spec/specs-go" + "github.com/opencontainers/runtime-spec/specs-go" "github.com/pkg/errors" "github.com/sirupsen/logrus" ) diff --git a/components/engine/daemon/graphdriver/aufs/dirs.go b/components/engine/daemon/graphdriver/aufs/dirs.go index 1ee47e40f6..e60be5e3c9 100644 --- a/components/engine/daemon/graphdriver/aufs/dirs.go +++ b/components/engine/daemon/graphdriver/aufs/dirs.go @@ -15,7 +15,7 @@ func loadIds(root string) ([]string, error) { if err != nil { return nil, err } - out := []string{} + var out []string for _, d := range dirs { if !d.IsDir() { out = append(out, d.Name()) @@ -36,7 +36,7 @@ func getParentIDs(root, id string) ([]string, error) { } defer f.Close() - out := []string{} + var out []string s := bufio.NewScanner(f) for s.Scan() { diff --git a/components/engine/daemon/graphdriver/devmapper/deviceset.go b/components/engine/daemon/graphdriver/devmapper/deviceset.go index dafe7661a2..2bfbf05a27 100644 --- a/components/engine/daemon/graphdriver/devmapper/deviceset.go +++ b/components/engine/daemon/graphdriver/devmapper/deviceset.go @@ -27,7 +27,7 @@ import ( "github.com/docker/docker/pkg/mount" "github.com/docker/docker/pkg/parsers" "github.com/docker/docker/pkg/parsers/kernel" - units "github.com/docker/go-units" + "github.com/docker/go-units" "github.com/opencontainers/selinux/go-selinux/label" "github.com/pkg/errors" "github.com/sirupsen/logrus" @@ -50,8 +50,8 @@ var ( lvmSetupConfigForce bool ) -const deviceSetMetaFile string = "deviceset-metadata" -const transactionMetaFile string = "transaction-metadata" +const deviceSetMetaFile = "deviceset-metadata" +const transactionMetaFile = "transaction-metadata" type transaction struct { OpenTransactionID uint64 `json:"open_transaction_id"` diff --git a/components/engine/daemon/graphdriver/devmapper/driver.go b/components/engine/daemon/graphdriver/devmapper/driver.go index 1384a3a157..df883de31d 100644 --- a/components/engine/daemon/graphdriver/devmapper/driver.go +++ b/components/engine/daemon/graphdriver/devmapper/driver.go @@ -15,7 +15,7 @@ import ( "github.com/docker/docker/pkg/idtools" "github.com/docker/docker/pkg/locker" "github.com/docker/docker/pkg/mount" - units "github.com/docker/go-units" + "github.com/docker/go-units" "github.com/pkg/errors" "github.com/sirupsen/logrus" "golang.org/x/sys/unix" diff --git a/components/engine/daemon/graphdriver/graphtest/graphtest_unix.go b/components/engine/daemon/graphdriver/graphtest/graphtest_unix.go index 1e068535f3..5ac3979752 100644 --- a/components/engine/daemon/graphdriver/graphtest/graphtest_unix.go +++ b/components/engine/daemon/graphdriver/graphtest/graphtest_unix.go @@ -15,7 +15,7 @@ import ( "github.com/docker/docker/daemon/graphdriver" "github.com/docker/docker/daemon/graphdriver/quota" "github.com/docker/docker/pkg/stringid" - units "github.com/docker/go-units" + "github.com/docker/go-units" "github.com/gotestyourself/gotestyourself/assert" is "github.com/gotestyourself/gotestyourself/assert/cmp" "golang.org/x/sys/unix" diff --git a/components/engine/daemon/graphdriver/graphtest/testutil.go b/components/engine/daemon/graphdriver/graphtest/testutil.go index ea9952858f..258aba7002 100644 --- a/components/engine/daemon/graphdriver/graphtest/testutil.go +++ b/components/engine/daemon/graphdriver/graphtest/testutil.go @@ -148,7 +148,7 @@ func changeManyFiles(drv graphdriver.Driver, layer string, count int, seed int64 } defer drv.Put(layer) - changes := []archive.Change{} + var changes []archive.Change for i := 0; i < count; i += 100 { archiveRoot := fmt.Sprintf("/directory-%d", i) if err := root.MkdirAll(root.Join(root.Path(), archiveRoot), 0755); err != nil { diff --git a/components/engine/daemon/graphdriver/vfs/driver.go b/components/engine/daemon/graphdriver/vfs/driver.go index c23c882ab2..e51cb6c250 100644 --- a/components/engine/daemon/graphdriver/vfs/driver.go +++ b/components/engine/daemon/graphdriver/vfs/driver.go @@ -10,7 +10,7 @@ import ( "github.com/docker/docker/pkg/containerfs" "github.com/docker/docker/pkg/idtools" "github.com/docker/docker/pkg/system" - units "github.com/docker/go-units" + "github.com/docker/go-units" "github.com/opencontainers/selinux/go-selinux/label" ) diff --git a/components/engine/daemon/graphdriver/zfs/zfs.go b/components/engine/daemon/graphdriver/zfs/zfs.go index eeceb4d3b8..1d9153e171 100644 --- a/components/engine/daemon/graphdriver/zfs/zfs.go +++ b/components/engine/daemon/graphdriver/zfs/zfs.go @@ -17,7 +17,7 @@ import ( "github.com/docker/docker/pkg/idtools" "github.com/docker/docker/pkg/mount" "github.com/docker/docker/pkg/parsers" - zfs "github.com/mistifyio/go-zfs" + "github.com/mistifyio/go-zfs" "github.com/opencontainers/selinux/go-selinux/label" "github.com/sirupsen/logrus" "golang.org/x/sys/unix" diff --git a/components/engine/daemon/images/image_delete.go b/components/engine/daemon/images/image_delete.go index 60896e487a..94d6f872dd 100644 --- a/components/engine/daemon/images/image_delete.go +++ b/components/engine/daemon/images/image_delete.go @@ -18,7 +18,7 @@ import ( type conflictType int const ( - conflictDependentChild conflictType = (1 << iota) + conflictDependentChild conflictType = 1 << iota conflictRunningContainer conflictActiveReference conflictStoppedContainer @@ -126,7 +126,7 @@ func (i *ImageService) ImageDelete(imageRef string, force, prune bool) ([]types. } if !foundRepoTagRef { // Remove canonical references from same repository - remainingRefs := []reference.Named{} + var remainingRefs []reference.Named for _, repoRef := range repoRefs { if _, repoRefIsCanonical := repoRef.(reference.Canonical); repoRefIsCanonical && parsedRef.Name() == repoRef.Name() { if _, err := i.removeImageRef(repoRef); err != nil { diff --git a/components/engine/daemon/images/image_prune.go b/components/engine/daemon/images/image_prune.go index da7f81322f..dd55347cf0 100644 --- a/components/engine/daemon/images/image_prune.go +++ b/components/engine/daemon/images/image_prune.go @@ -13,7 +13,7 @@ import ( "github.com/docker/docker/errdefs" "github.com/docker/docker/image" "github.com/docker/docker/layer" - digest "github.com/opencontainers/go-digest" + "github.com/opencontainers/go-digest" "github.com/sirupsen/logrus" ) diff --git a/components/engine/daemon/images/locals.go b/components/engine/daemon/images/locals.go index a57ea2da60..5ffc460a09 100644 --- a/components/engine/daemon/images/locals.go +++ b/components/engine/daemon/images/locals.go @@ -3,7 +3,7 @@ package images // import "github.com/docker/docker/daemon/images" import ( "fmt" - metrics "github.com/docker/go-metrics" + "github.com/docker/go-metrics" ) type invalidFilter struct { diff --git a/components/engine/daemon/logger/adapter.go b/components/engine/daemon/logger/adapter.go index 5b9252d324..95aff9bf3b 100644 --- a/components/engine/daemon/logger/adapter.go +++ b/components/engine/daemon/logger/adapter.go @@ -37,7 +37,7 @@ func (a *pluginAdapter) Log(msg *Message) error { a.buf.Line = msg.Line a.buf.TimeNano = msg.Timestamp.UnixNano() - a.buf.Partial = (msg.PLogMetaData != nil) + a.buf.Partial = msg.PLogMetaData != nil a.buf.Source = msg.Source err := a.enc.Encode(&a.buf) diff --git a/components/engine/daemon/logger/awslogs/cloudwatchlogs_test.go b/components/engine/daemon/logger/awslogs/cloudwatchlogs_test.go index 2884f01e28..b8e49055e8 100644 --- a/components/engine/daemon/logger/awslogs/cloudwatchlogs_test.go +++ b/components/engine/daemon/logger/awslogs/cloudwatchlogs_test.go @@ -1139,8 +1139,8 @@ func TestCollectBatchWithDuplicateTimestamps(t *testing.T) { close(d) go stream.collectBatch(d) + var expectedEvents []*cloudwatchlogs.InputLogEvent times := maximumLogEventsPerPut - expectedEvents := []*cloudwatchlogs.InputLogEvent{} timestamp := time.Now() for i := 0; i < times; i++ { line := fmt.Sprintf("%d", i) diff --git a/components/engine/daemon/logger/factory.go b/components/engine/daemon/logger/factory.go index 9723f7fc0c..84b54b2794 100644 --- a/components/engine/daemon/logger/factory.go +++ b/components/engine/daemon/logger/factory.go @@ -7,7 +7,7 @@ import ( containertypes "github.com/docker/docker/api/types/container" "github.com/docker/docker/pkg/plugingetter" - units "github.com/docker/go-units" + "github.com/docker/go-units" "github.com/pkg/errors" ) diff --git a/components/engine/daemon/logger/gcplogs/gcplogging.go b/components/engine/daemon/logger/gcplogs/gcplogging.go index 08b632b627..1699f67a2d 100644 --- a/components/engine/daemon/logger/gcplogs/gcplogging.go +++ b/components/engine/daemon/logger/gcplogs/gcplogging.go @@ -1,13 +1,12 @@ package gcplogs // import "github.com/docker/docker/daemon/logger/gcplogs" import ( + "context" "fmt" "sync" "sync/atomic" "time" - "context" - "github.com/docker/docker/daemon/logger" "cloud.google.com/go/compute/metadata" diff --git a/components/engine/daemon/logger/jsonfilelog/jsonfilelog.go b/components/engine/daemon/logger/jsonfilelog/jsonfilelog.go index 7d0533ec84..b806a5ad17 100644 --- a/components/engine/daemon/logger/jsonfilelog/jsonfilelog.go +++ b/components/engine/daemon/logger/jsonfilelog/jsonfilelog.go @@ -13,7 +13,7 @@ import ( "github.com/docker/docker/daemon/logger" "github.com/docker/docker/daemon/logger/jsonfilelog/jsonlog" "github.com/docker/docker/daemon/logger/loggerutils" - units "github.com/docker/go-units" + "github.com/docker/go-units" "github.com/pkg/errors" "github.com/sirupsen/logrus" ) diff --git a/components/engine/daemon/logger/loggerutils/multireader/multireader_test.go b/components/engine/daemon/logger/loggerutils/multireader/multireader_test.go index 15461c40de..2fb66ab566 100644 --- a/components/engine/daemon/logger/loggerutils/multireader/multireader_test.go +++ b/components/engine/daemon/logger/loggerutils/multireader/multireader_test.go @@ -205,7 +205,7 @@ func TestMultiReadSeekerCurAfterSet(t *testing.T) { } func TestMultiReadSeekerSmallReads(t *testing.T) { - readers := []io.ReadSeeker{} + var readers []io.ReadSeeker for i := 0; i < 10; i++ { integer := make([]byte, 4) binary.BigEndian.PutUint32(integer, uint32(i)) diff --git a/components/engine/daemon/metrics.go b/components/engine/daemon/metrics.go index 02a36603c9..8ee6432eaa 100644 --- a/components/engine/daemon/metrics.go +++ b/components/engine/daemon/metrics.go @@ -4,7 +4,7 @@ import ( "sync" "github.com/docker/docker/pkg/plugingetter" - metrics "github.com/docker/go-metrics" + "github.com/docker/go-metrics" "github.com/pkg/errors" "github.com/prometheus/client_golang/prometheus" "github.com/sirupsen/logrus" diff --git a/components/engine/daemon/metrics_unix.go b/components/engine/daemon/metrics_unix.go index fbf561e917..9311915249 100644 --- a/components/engine/daemon/metrics_unix.go +++ b/components/engine/daemon/metrics_unix.go @@ -10,8 +10,8 @@ import ( "github.com/docker/docker/pkg/plugingetter" "github.com/docker/docker/pkg/plugins" "github.com/docker/docker/plugin" - metrics "github.com/docker/go-metrics" - specs "github.com/opencontainers/runtime-spec/specs-go" + "github.com/docker/go-metrics" + "github.com/opencontainers/runtime-spec/specs-go" "github.com/pkg/errors" "github.com/sirupsen/logrus" "golang.org/x/sys/unix" diff --git a/components/engine/daemon/oci_linux.go b/components/engine/daemon/oci_linux.go index 49ba0e13c3..b675eaf406 100644 --- a/components/engine/daemon/oci_linux.go +++ b/components/engine/daemon/oci_linux.go @@ -23,7 +23,7 @@ import ( "github.com/opencontainers/runc/libcontainer/cgroups" "github.com/opencontainers/runc/libcontainer/devices" "github.com/opencontainers/runc/libcontainer/user" - specs "github.com/opencontainers/runtime-spec/specs-go" + "github.com/opencontainers/runtime-spec/specs-go" "github.com/pkg/errors" "github.com/sirupsen/logrus" "golang.org/x/sys/unix" diff --git a/components/engine/daemon/reload_test.go b/components/engine/daemon/reload_test.go index 9174bfba54..f20126452a 100644 --- a/components/engine/daemon/reload_test.go +++ b/components/engine/daemon/reload_test.go @@ -89,7 +89,7 @@ func TestDaemonReloadAllowNondistributableArtifacts(t *testing.T) { t.Fatal(err) } - actual := []string{} + var actual []string serviceConfig := daemon.RegistryService.ServiceConfig() for _, value := range serviceConfig.AllowNondistributableArtifactsCIDRs { actual = append(actual, value.String()) diff --git a/components/engine/daemon/update_linux.go b/components/engine/daemon/update_linux.go index 14bd91446a..6a307eabc5 100644 --- a/components/engine/daemon/update_linux.go +++ b/components/engine/daemon/update_linux.go @@ -5,7 +5,7 @@ import ( "github.com/docker/docker/api/types/container" "github.com/docker/docker/libcontainerd" - specs "github.com/opencontainers/runtime-spec/specs-go" + "github.com/opencontainers/runtime-spec/specs-go" ) func toContainerdResources(resources container.Resources) *libcontainerd.Resources { diff --git a/components/engine/distribution/errors_test.go b/components/engine/distribution/errors_test.go index 95c40e8a04..7105bdb4d6 100644 --- a/components/engine/distribution/errors_test.go +++ b/components/engine/distribution/errors_test.go @@ -48,7 +48,7 @@ func TestContinueOnError_NonMirrorEndpoint(t *testing.T) { } func TestContinueOnError_MirrorEndpoint(t *testing.T) { - errs := []error{} + var errs []error errs = append(errs, alwaysContinue...) errs = append(errs, continueFromMirrorEndpoint...) for _, err := range errs { diff --git a/components/engine/distribution/pull_v2.go b/components/engine/distribution/pull_v2.go index 93b9a5a6f0..60a894b1c3 100644 --- a/components/engine/distribution/pull_v2.go +++ b/components/engine/distribution/pull_v2.go @@ -30,7 +30,7 @@ import ( "github.com/docker/docker/pkg/system" refstore "github.com/docker/docker/reference" "github.com/docker/docker/registry" - digest "github.com/opencontainers/go-digest" + "github.com/opencontainers/go-digest" specs "github.com/opencontainers/image-spec/specs-go/v1" "github.com/pkg/errors" "github.com/sirupsen/logrus" diff --git a/components/engine/distribution/push_v2.go b/components/engine/distribution/push_v2.go index 5e360591f4..9dc3e7a2a6 100644 --- a/components/engine/distribution/push_v2.go +++ b/components/engine/distribution/push_v2.go @@ -24,7 +24,7 @@ import ( "github.com/docker/docker/pkg/progress" "github.com/docker/docker/pkg/stringid" "github.com/docker/docker/registry" - digest "github.com/opencontainers/go-digest" + "github.com/opencontainers/go-digest" "github.com/sirupsen/logrus" ) diff --git a/components/engine/dockerversion/version_lib.go b/components/engine/dockerversion/version_lib.go index 1489be0a25..0897c0728e 100644 --- a/components/engine/dockerversion/version_lib.go +++ b/components/engine/dockerversion/version_lib.go @@ -6,12 +6,12 @@ package dockerversion // import "github.com/docker/docker/dockerversion" // Default build-time variable for library-import. // This file is overridden on build with build-time informations. const ( - GitCommit string = "library-import" - Version string = "library-import" - BuildTime string = "library-import" - IAmStatic string = "library-import" - ContainerdCommitID string = "library-import" - RuncCommitID string = "library-import" - InitCommitID string = "library-import" - PlatformName string = "" + GitCommit = "library-import" + Version = "library-import" + BuildTime = "library-import" + IAmStatic = "library-import" + ContainerdCommitID = "library-import" + RuncCommitID = "library-import" + InitCommitID = "library-import" + PlatformName = "" ) diff --git a/components/engine/hack/integration-cli-on-swarm/agent/master/set_test.go b/components/engine/hack/integration-cli-on-swarm/agent/master/set_test.go index dfb7a0b4f8..c172562b1b 100644 --- a/components/engine/hack/integration-cli-on-swarm/agent/master/set_test.go +++ b/components/engine/hack/integration-cli-on-swarm/agent/master/set_test.go @@ -8,7 +8,7 @@ import ( ) func generateInput(inputLen int) []string { - input := []string{} + var input []string for i := 0; i < inputLen; i++ { input = append(input, fmt.Sprintf("s%d", i)) } @@ -21,7 +21,7 @@ func testChunkStrings(t *testing.T, inputLen, numChunks int) { input := generateInput(inputLen) result := chunkStrings(input, numChunks) t.Logf("result has %d chunks", len(result)) - inputReconstructedFromResult := []string{} + var inputReconstructedFromResult []string for i, chunk := range result { t.Logf("chunk %d has %d elements", i, len(chunk)) inputReconstructedFromResult = append(inputReconstructedFromResult, chunk...) diff --git a/components/engine/image/tarexport/load.go b/components/engine/image/tarexport/load.go index 4d120068b6..c89dd08f93 100644 --- a/components/engine/image/tarexport/load.go +++ b/components/engine/image/tarexport/load.go @@ -23,7 +23,7 @@ import ( "github.com/docker/docker/pkg/stringid" "github.com/docker/docker/pkg/symlink" "github.com/docker/docker/pkg/system" - digest "github.com/opencontainers/go-digest" + "github.com/opencontainers/go-digest" "github.com/sirupsen/logrus" ) diff --git a/components/engine/integration-cli/docker_api_build_test.go b/components/engine/integration-cli/docker_api_build_test.go index 594185f14d..581df8d5c7 100644 --- a/components/engine/integration-cli/docker_api_build_test.go +++ b/components/engine/integration-cli/docker_api_build_test.go @@ -543,7 +543,7 @@ type buildLine struct { } func getImageIDsFromBuild(c *check.C, output []byte) []string { - ids := []string{} + var ids []string for _, line := range bytes.Split(output, []byte("\n")) { if len(line) == 0 { continue diff --git a/components/engine/integration-cli/docker_api_network_test.go b/components/engine/integration-cli/docker_api_network_test.go index c159c80a0a..9c22cb7e3a 100644 --- a/components/engine/integration-cli/docker_api_network_test.go +++ b/components/engine/integration-cli/docker_api_network_test.go @@ -289,7 +289,7 @@ func isNetworkAvailable(c *check.C, name string) bool { defer resp.Body.Close() c.Assert(resp.StatusCode, checker.Equals, http.StatusOK) - nJSON := []types.NetworkResource{} + var nJSON []types.NetworkResource err = json.NewDecoder(body).Decode(&nJSON) c.Assert(err, checker.IsNil) @@ -315,7 +315,7 @@ func getNetworkIDByName(c *check.C, name string) string { c.Assert(resp.StatusCode, checker.Equals, http.StatusOK) c.Assert(err, checker.IsNil) - nJSON := []types.NetworkResource{} + var nJSON []types.NetworkResource err = json.NewDecoder(body).Decode(&nJSON) c.Assert(err, checker.IsNil) var res string diff --git a/components/engine/integration-cli/docker_cli_build_test.go b/components/engine/integration-cli/docker_cli_build_test.go index e4edc8e642..a87e4aaaf1 100644 --- a/components/engine/integration-cli/docker_cli_build_test.go +++ b/components/engine/integration-cli/docker_cli_build_test.go @@ -27,7 +27,7 @@ import ( "github.com/docker/docker/pkg/archive" "github.com/go-check/check" "github.com/gotestyourself/gotestyourself/icmd" - digest "github.com/opencontainers/go-digest" + "github.com/opencontainers/go-digest" ) func (s *DockerSuite) TestBuildJSONEmptyRun(c *check.C) { @@ -195,7 +195,7 @@ func (s *DockerSuite) TestBuildEnvironmentReplacementEnv(c *check.C) { RUN [ "$foo5" = 'abc\def' ] `)) - envResult := []string{} + var envResult []string inspectFieldAndUnmarshall(c, name, "Config.Env", &envResult) found := false envCount := 0 @@ -4979,7 +4979,7 @@ func (s *DockerSuite) TestBuildLabelMultiple(c *check.C) { "foo": "bar", "123": "456", } - labelArgs := []string{} + var labelArgs []string for k, v := range testLabels { labelArgs = append(labelArgs, "--label", k+"="+v) } diff --git a/components/engine/integration-cli/docker_cli_build_unix_test.go b/components/engine/integration-cli/docker_cli_build_unix_test.go index f2d598ef58..d6c4370064 100644 --- a/components/engine/integration-cli/docker_cli_build_unix_test.go +++ b/components/engine/integration-cli/docker_cli_build_unix_test.go @@ -19,7 +19,7 @@ import ( "github.com/docker/docker/integration-cli/cli" "github.com/docker/docker/integration-cli/cli/build" "github.com/docker/docker/internal/test/fakecontext" - units "github.com/docker/go-units" + "github.com/docker/go-units" "github.com/go-check/check" "github.com/gotestyourself/gotestyourself/icmd" ) diff --git a/components/engine/integration-cli/docker_cli_create_test.go b/components/engine/integration-cli/docker_cli_create_test.go index bf7096123b..9ec400b2e1 100644 --- a/components/engine/integration-cli/docker_cli_create_test.go +++ b/components/engine/integration-cli/docker_cli_create_test.go @@ -26,13 +26,13 @@ func (s *DockerSuite) TestCreateArgs(c *check.C) { out, _ = dockerCmd(c, "inspect", cleanedContainerID) - containers := []struct { + var containers []struct { ID string Created time.Time Path string Args []string Image string - }{} + } err := json.Unmarshal([]byte(out), &containers) c.Assert(err, check.IsNil, check.Commentf("Error inspecting the container: %s", err)) @@ -87,11 +87,11 @@ func (s *DockerSuite) TestCreateHostConfig(c *check.C) { out, _ = dockerCmd(c, "inspect", cleanedContainerID) - containers := []struct { + var containers []struct { HostConfig *struct { PublishAllPorts bool } - }{} + } err := json.Unmarshal([]byte(out), &containers) c.Assert(err, check.IsNil, check.Commentf("Error inspecting the container: %s", err)) @@ -109,11 +109,11 @@ func (s *DockerSuite) TestCreateWithPortRange(c *check.C) { out, _ = dockerCmd(c, "inspect", cleanedContainerID) - containers := []struct { + var containers []struct { HostConfig *struct { PortBindings map[nat.Port][]nat.PortBinding } - }{} + } err := json.Unmarshal([]byte(out), &containers) c.Assert(err, check.IsNil, check.Commentf("Error inspecting the container: %s", err)) c.Assert(containers, checker.HasLen, 1) @@ -138,11 +138,11 @@ func (s *DockerSuite) TestCreateWithLargePortRange(c *check.C) { out, _ = dockerCmd(c, "inspect", cleanedContainerID) - containers := []struct { + var containers []struct { HostConfig *struct { PortBindings map[nat.Port][]nat.PortBinding } - }{} + } err := json.Unmarshal([]byte(out), &containers) c.Assert(err, check.IsNil, check.Commentf("Error inspecting the container: %s", err)) diff --git a/components/engine/integration-cli/docker_cli_daemon_test.go b/components/engine/integration-cli/docker_cli_daemon_test.go index 5015736a31..347696e8a4 100644 --- a/components/engine/integration-cli/docker_cli_daemon_test.go +++ b/components/engine/integration-cli/docker_cli_daemon_test.go @@ -6,6 +6,8 @@ import ( "bufio" "bytes" "context" + "crypto/tls" + "crypto/x509" "encoding/json" "fmt" "io" @@ -21,9 +23,6 @@ import ( "sync" "time" - "crypto/tls" - "crypto/x509" - "github.com/cloudflare/cfssl/helpers" "github.com/docker/docker/api" "github.com/docker/docker/api/types" @@ -36,7 +35,7 @@ import ( testdaemon "github.com/docker/docker/internal/test/daemon" "github.com/docker/docker/opts" "github.com/docker/docker/pkg/mount" - units "github.com/docker/go-units" + "github.com/docker/go-units" "github.com/docker/libnetwork/iptables" "github.com/docker/libtrust" "github.com/go-check/check" @@ -1828,8 +1827,8 @@ func (s *DockerDaemonSuite) TestDaemonNoSpaceLeftOnDeviceError(c *check.C) { func (s *DockerDaemonSuite) TestDaemonRestartContainerLinksRestart(c *check.C) { s.d.StartWithBusybox(c) - parent1Args := []string{} - parent2Args := []string{} + var parent1Args []string + var parent2Args []string wg := sync.WaitGroup{} maxChildren := 10 chErr := make(chan error, maxChildren) diff --git a/components/engine/integration-cli/docker_cli_exec_test.go b/components/engine/integration-cli/docker_cli_exec_test.go index 9804b3a643..d0557c56a0 100644 --- a/components/engine/integration-cli/docker_cli_exec_test.go +++ b/components/engine/integration-cli/docker_cli_exec_test.go @@ -262,7 +262,7 @@ func (s *DockerSuite) TestExecCgroup(c *check.C) { var wg sync.WaitGroup var mu sync.Mutex - execCgroups := []sort.StringSlice{} + var execCgroups []sort.StringSlice errChan := make(chan error) // exec a few times concurrently to get consistent failure for i := 0; i < 5; i++ { diff --git a/components/engine/integration-cli/docker_cli_network_unix_test.go b/components/engine/integration-cli/docker_cli_network_unix_test.go index f3ecd62187..1087d0045d 100644 --- a/components/engine/integration-cli/docker_cli_network_unix_test.go +++ b/components/engine/integration-cli/docker_cli_network_unix_test.go @@ -273,7 +273,7 @@ func assertNwList(c *check.C, out string, expectNws []string) { func getNwResource(c *check.C, name string) *types.NetworkResource { out, _ := dockerCmd(c, "network", "inspect", name) - nr := []types.NetworkResource{} + var nr []types.NetworkResource err := json.Unmarshal([]byte(out), &nr) c.Assert(err, check.IsNil) return &nr[0] @@ -426,7 +426,7 @@ func (s *DockerSuite) TestDockerNetworkDeleteMultiple(c *check.C) { func (s *DockerSuite) TestDockerNetworkInspect(c *check.C) { out, _ := dockerCmd(c, "network", "inspect", "host") - networkResources := []types.NetworkResource{} + var networkResources []types.NetworkResource err := json.Unmarshal([]byte(out), &networkResources) c.Assert(err, check.IsNil) c.Assert(networkResources, checker.HasLen, 1) @@ -450,7 +450,7 @@ func (s *DockerSuite) TestDockerInspectMultipleNetwork(c *check.C) { result := dockerCmdWithResult("network", "inspect", "host", "none") result.Assert(c, icmd.Success) - networkResources := []types.NetworkResource{} + var networkResources []types.NetworkResource err := json.Unmarshal([]byte(result.Stdout()), &networkResources) c.Assert(err, check.IsNil) c.Assert(networkResources, checker.HasLen, 2) @@ -466,7 +466,7 @@ func (s *DockerSuite) TestDockerInspectMultipleNetworksIncludingNonexistent(c *c Out: "host", }) - networkResources := []types.NetworkResource{} + var networkResources []types.NetworkResource err := json.Unmarshal([]byte(result.Stdout()), &networkResources) c.Assert(err, check.IsNil) c.Assert(networkResources, checker.HasLen, 1) @@ -512,7 +512,7 @@ func (s *DockerSuite) TestDockerInspectNetworkWithContainerName(c *check.C) { }() out, _ = dockerCmd(c, "network", "inspect", "brNetForInspect") - networkResources := []types.NetworkResource{} + var networkResources []types.NetworkResource err := json.Unmarshal([]byte(out), &networkResources) c.Assert(err, check.IsNil) c.Assert(networkResources, checker.HasLen, 1) @@ -526,7 +526,7 @@ func (s *DockerSuite) TestDockerInspectNetworkWithContainerName(c *check.C) { // check whether network inspect works properly out, _ = dockerCmd(c, "network", "inspect", "brNetForInspect") - newNetRes := []types.NetworkResource{} + var newNetRes []types.NetworkResource err = json.Unmarshal([]byte(out), &newNetRes) c.Assert(err, check.IsNil) c.Assert(newNetRes, checker.HasLen, 1) diff --git a/components/engine/integration-cli/docker_cli_ps_test.go b/components/engine/integration-cli/docker_cli_ps_test.go index fea51dd0bd..771c9d70d5 100644 --- a/components/engine/integration-cli/docker_cli_ps_test.go +++ b/components/engine/integration-cli/docker_cli_ps_test.go @@ -172,7 +172,7 @@ func (s *DockerSuite) TestPsListContainersSize(c *check.C) { idIndex := strings.Index(lines[0], "CONTAINER ID") foundID := lines[1][idIndex : idIndex+12] c.Assert(foundID, checker.Equals, id[:12], check.Commentf("Expected id %s, got %s", id[:12], foundID)) - expectedSize := fmt.Sprintf("%dB", (2 + baseBytes)) + expectedSize := fmt.Sprintf("%dB", 2+baseBytes) foundSize := lines[1][sizeIndex:] c.Assert(foundSize, checker.Contains, expectedSize, check.Commentf("Expected size %q, got %q", expectedSize, foundSize)) } @@ -377,7 +377,7 @@ func (s *DockerSuite) TestPsListContainersFilterAncestorImage(c *check.C) { } func checkPsAncestorFilterOutput(c *check.C, out string, filterName string, expectedIDs []string) { - actualIDs := []string{} + var actualIDs []string if out != "" { actualIDs = strings.Split(out[:len(out)-1], "\n") } diff --git a/components/engine/integration-cli/docker_cli_pull_local_test.go b/components/engine/integration-cli/docker_cli_pull_local_test.go index 79b9390d28..31afdfb539 100644 --- a/components/engine/integration-cli/docker_cli_pull_local_test.go +++ b/components/engine/integration-cli/docker_cli_pull_local_test.go @@ -27,7 +27,7 @@ import ( func testPullImageWithAliases(c *check.C) { repoName := fmt.Sprintf("%v/dockercli/busybox", privateRegistryURL) - repos := []string{} + var repos []string for _, tag := range []string{"recent", "fresh"} { repos = append(repos, fmt.Sprintf("%v:%v", repoName, tag)) } @@ -63,7 +63,7 @@ func (s *DockerSchema1RegistrySuite) TestPullImageWithAliases(c *check.C) { func testConcurrentPullWholeRepo(c *check.C) { repoName := fmt.Sprintf("%v/dockercli/busybox", privateRegistryURL) - repos := []string{} + var repos []string for _, tag := range []string{"recent", "fresh", "todays"} { repo := fmt.Sprintf("%v:%v", repoName, tag) buildImageSuccessfully(c, repo, build.WithDockerfile(fmt.Sprintf(` @@ -151,7 +151,7 @@ func (s *DockerSchema1RegistrySuite) testConcurrentFailingPull(c *check.C) { func testConcurrentPullMultipleTags(c *check.C) { repoName := fmt.Sprintf("%v/dockercli/busybox", privateRegistryURL) - repos := []string{} + var repos []string for _, tag := range []string{"recent", "fresh", "todays"} { repo := fmt.Sprintf("%v:%v", repoName, tag) buildImageSuccessfully(c, repo, build.WithDockerfile(fmt.Sprintf(` diff --git a/components/engine/integration-cli/docker_cli_push_test.go b/components/engine/integration-cli/docker_cli_push_test.go index 48d6be2ac1..382260a5c7 100644 --- a/components/engine/integration-cli/docker_cli_push_test.go +++ b/components/engine/integration-cli/docker_cli_push_test.go @@ -155,7 +155,7 @@ func (s *DockerSchema1RegistrySuite) TestPushEmptyLayer(c *check.C) { func testConcurrentPush(c *check.C) { repoName := fmt.Sprintf("%v/dockercli/busybox", privateRegistryURL) - repos := []string{} + var repos []string for _, tag := range []string{"push1", "push2", "push3"} { repo := fmt.Sprintf("%v:%v", repoName, tag) buildImageSuccessfully(c, repo, build.WithDockerfile(fmt.Sprintf(` diff --git a/components/engine/integration-cli/docker_cli_save_load_test.go b/components/engine/integration-cli/docker_cli_save_load_test.go index 3077c0b46d..d370b6cc5e 100644 --- a/components/engine/integration-cli/docker_cli_save_load_test.go +++ b/components/engine/integration-cli/docker_cli_save_load_test.go @@ -19,7 +19,7 @@ import ( "github.com/docker/docker/integration-cli/cli/build" "github.com/go-check/check" "github.com/gotestyourself/gotestyourself/icmd" - digest "github.com/opencontainers/go-digest" + "github.com/opencontainers/go-digest" ) // save a repo using gz compression and try to load it using stdout @@ -100,10 +100,10 @@ func (s *DockerSuite) TestSaveCheckTimes(c *check.C) { testRequires(c, DaemonIsLinux) repoName := "busybox:latest" out, _ := dockerCmd(c, "inspect", repoName) - data := []struct { + var data []struct { ID string Created time.Time - }{} + } err := json.Unmarshal([]byte(out), &data) c.Assert(err, checker.IsNil, check.Commentf("failed to marshal from %q: err %v", repoName, err)) c.Assert(len(data), checker.Not(checker.Equals), 0, check.Commentf("failed to marshal the data from %q", repoName)) diff --git a/components/engine/integration-cli/docker_cli_sni_test.go b/components/engine/integration-cli/docker_cli_sni_test.go index fb896d52d5..f50b5bbf6d 100644 --- a/components/engine/integration-cli/docker_cli_sni_test.go +++ b/components/engine/integration-cli/docker_cli_sni_test.go @@ -16,7 +16,7 @@ import ( func (s *DockerSuite) TestClientSetsTLSServerName(c *check.C) { c.Skip("Flakey test") // there may be more than one hit to the server for each registry request - serverNameReceived := []string{} + var serverNameReceived []string var serverName string virtualHostServer := httptest.NewTLSServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { diff --git a/components/engine/integration-cli/environment/environment.go b/components/engine/integration-cli/environment/environment.go index 2d7702f14c..82cf99652b 100644 --- a/components/engine/integration-cli/environment/environment.go +++ b/components/engine/integration-cli/environment/environment.go @@ -2,7 +2,6 @@ package environment // import "github.com/docker/docker/integration-cli/environm import ( "os" - "os/exec" "github.com/docker/docker/internal/test/environment" diff --git a/components/engine/integration-cli/utils_test.go b/components/engine/integration-cli/utils_test.go index 6c18c222d2..33913c3922 100644 --- a/components/engine/integration-cli/utils_test.go +++ b/components/engine/integration-cli/utils_test.go @@ -119,7 +119,7 @@ type elementListOptions struct { } func existingElements(c *check.C, opts elementListOptions) []string { - args := []string{} + var args []string switch opts.element { case "container": args = append(args, "ps", "-a") @@ -136,7 +136,7 @@ func existingElements(c *check.C, opts elementListOptions) []string { args = append(args, "--format", opts.format) } out, _ := dockerCmd(c, args...) - lines := []string{} + var lines []string for _, l := range strings.Split(out, "\n") { if l != "" { lines = append(lines, l) diff --git a/components/engine/integration/build/build_test.go b/components/engine/integration/build/build_test.go index 352f7c152d..83d992d14f 100644 --- a/components/engine/integration/build/build_test.go +++ b/components/engine/integration/build/build_test.go @@ -443,7 +443,7 @@ type buildLine struct { } func getImageIDsFromBuild(output []byte) ([]string, error) { - ids := []string{} + var ids []string for _, line := range bytes.Split(output, []byte("\n")) { if len(line) == 0 { continue diff --git a/components/engine/integration/config/config_test.go b/components/engine/integration/config/config_test.go index d698445f2b..1c002423ea 100644 --- a/components/engine/integration/config/config_test.go +++ b/components/engine/integration/config/config_test.go @@ -46,7 +46,7 @@ func TestConfigList(t *testing.T) { config1ID := createConfig(ctx, t, client, testName1, []byte("TESTINGDATA1"), map[string]string{"type": "production"}) names := func(entries []swarmtypes.Config) []string { - values := []string{} + var values []string for _, entry := range entries { values = append(values, entry.Spec.Name) } diff --git a/components/engine/integration/container/pause_test.go b/components/engine/integration/container/pause_test.go index 8854dd9fd9..8f856bcb3c 100644 --- a/components/engine/integration/container/pause_test.go +++ b/components/engine/integration/container/pause_test.go @@ -51,7 +51,7 @@ func TestPause(t *testing.T) { } func TestPauseFailsOnWindowsServerContainers(t *testing.T) { - skip.If(t, (testEnv.DaemonInfo.OSType != "windows" || testEnv.DaemonInfo.Isolation != "process")) + skip.If(t, testEnv.DaemonInfo.OSType != "windows" || testEnv.DaemonInfo.Isolation != "process") defer setupTest(t)() client := request.NewAPIClient(t) @@ -85,7 +85,7 @@ func TestPauseStopPausedContainer(t *testing.T) { } func getEventActions(t *testing.T, messages <-chan events.Message, errs <-chan error) []string { - actions := []string{} + var actions []string for { select { case err := <-errs: diff --git a/components/engine/integration/container/ps_test.go b/components/engine/integration/container/ps_test.go index 7ee92481e9..1080cd2f57 100644 --- a/components/engine/integration/container/ps_test.go +++ b/components/engine/integration/container/ps_test.go @@ -22,7 +22,7 @@ func TestPsFilter(t *testing.T) { next := container.Create(t, ctx, client) containerIDs := func(containers []types.Container) []string { - entries := []string{} + var entries []string for _, container := range containers { entries = append(entries, container.ID) } diff --git a/components/engine/integration/network/service_test.go b/components/engine/integration/network/service_test.go index 2ae1897c6d..9b0c027598 100644 --- a/components/engine/integration/network/service_test.go +++ b/components/engine/integration/network/service_test.go @@ -173,8 +173,8 @@ func TestDaemonRestartWithExistingNetworkWithDefaultPoolRange(t *testing.T) { out1, err := cli.NetworkInspect(context.Background(), name, types.NetworkInspectOptions{}) assert.NilError(t, err) - assert.Check(t, (out1.IPAM.Config[0].Subnet != networkip)) - assert.Check(t, (out1.IPAM.Config[0].Subnet != networkip2)) + assert.Check(t, out1.IPAM.Config[0].Subnet != networkip) + assert.Check(t, out1.IPAM.Config[0].Subnet != networkip2) delInterface(t, defaultNetworkBridge) } diff --git a/components/engine/integration/secret/secret_test.go b/components/engine/integration/secret/secret_test.go index 96a02a6ec5..9c5617efc6 100644 --- a/components/engine/integration/secret/secret_test.go +++ b/components/engine/integration/secret/secret_test.go @@ -63,7 +63,7 @@ func TestSecretList(t *testing.T) { secret1ID := createSecret(ctx, t, client, testName1, []byte("TESTINGDATA1"), map[string]string{"type": "production"}) names := func(entries []swarmtypes.Secret) []string { - values := []string{} + var values []string for _, entry := range entries { values = append(values, entry.Spec.Name) } diff --git a/components/engine/internal/test/environment/protect.go b/components/engine/internal/test/environment/protect.go index 59acdf418e..6d57dedb1c 100644 --- a/components/engine/internal/test/environment/protect.go +++ b/components/engine/internal/test/environment/protect.go @@ -77,7 +77,7 @@ func getExistingContainers(t assert.TestingT, testEnv *Execution) []string { }) assert.NilError(t, err, "failed to list containers") - containers := []string{} + var containers []string for _, container := range containerList { containers = append(containers, container.ID) } @@ -121,7 +121,7 @@ func getExistingImages(t assert.TestingT, testEnv *Execution) []string { }) assert.NilError(t, err, "failed to list images") - images := []string{} + var images []string for _, image := range imageList { images = append(images, tagsFromImageSummary(image)...) } @@ -129,7 +129,7 @@ func getExistingImages(t assert.TestingT, testEnv *Execution) []string { } func tagsFromImageSummary(image types.ImageSummary) []string { - result := []string{} + var result []string for _, tag := range image.RepoTags { if tag != ":" { result = append(result, tag) @@ -172,7 +172,7 @@ func getExistingNetworks(t assert.TestingT, testEnv *Execution) []string { networkList, err := client.NetworkList(context.Background(), types.NetworkListOptions{}) assert.NilError(t, err, "failed to list networks") - networks := []string{} + var networks []string for _, network := range networkList { networks = append(networks, network.ID) } @@ -211,7 +211,7 @@ func getExistingPlugins(t assert.TestingT, testEnv *Execution) []string { } assert.NilError(t, err, "failed to list plugins") - plugins := []string{} + var plugins []string for _, plugin := range pluginList { plugins = append(plugins, plugin.Name) } @@ -246,7 +246,7 @@ func getExistingVolumes(t assert.TestingT, testEnv *Execution) []string { volumeList, err := client.VolumeList(context.Background(), filters.Args{}) assert.NilError(t, err, "failed to list volumes") - volumes := []string{} + var volumes []string for _, volume := range volumeList.Volumes { volumes = append(volumes, volume.Name) } diff --git a/components/engine/libcontainerd/client_daemon_linux.go b/components/engine/libcontainerd/client_daemon_linux.go index a2237dc9f5..b57c4d3c50 100644 --- a/components/engine/libcontainerd/client_daemon_linux.go +++ b/components/engine/libcontainerd/client_daemon_linux.go @@ -10,7 +10,7 @@ import ( "github.com/containerd/containerd" "github.com/containerd/containerd/cio" "github.com/docker/docker/pkg/idtools" - specs "github.com/opencontainers/runtime-spec/specs-go" + "github.com/opencontainers/runtime-spec/specs-go" "github.com/sirupsen/logrus" ) diff --git a/components/engine/libcontainerd/types_linux.go b/components/engine/libcontainerd/types_linux.go index ae7a757c65..943382b9b0 100644 --- a/components/engine/libcontainerd/types_linux.go +++ b/components/engine/libcontainerd/types_linux.go @@ -4,7 +4,7 @@ import ( "time" "github.com/containerd/cgroups" - specs "github.com/opencontainers/runtime-spec/specs-go" + "github.com/opencontainers/runtime-spec/specs-go" ) // Summary is not used on linux diff --git a/components/engine/migrate/v1/migratev1.go b/components/engine/migrate/v1/migratev1.go index 4777c16c55..9cd759a3b8 100644 --- a/components/engine/migrate/v1/migratev1.go +++ b/components/engine/migrate/v1/migratev1.go @@ -1,6 +1,7 @@ package v1 // import "github.com/docker/docker/migrate/v1" import ( + "encoding/json" "errors" "fmt" "io/ioutil" @@ -11,8 +12,6 @@ import ( "sync" "time" - "encoding/json" - "github.com/docker/distribution/reference" "github.com/docker/docker/distribution/metadata" "github.com/docker/docker/image" diff --git a/components/engine/oci/devices_linux.go b/components/engine/oci/devices_linux.go index 7f1658e53c..46d4e1d32d 100644 --- a/components/engine/oci/devices_linux.go +++ b/components/engine/oci/devices_linux.go @@ -8,7 +8,7 @@ import ( "github.com/opencontainers/runc/libcontainer/configs" "github.com/opencontainers/runc/libcontainer/devices" - specs "github.com/opencontainers/runtime-spec/specs-go" + "github.com/opencontainers/runtime-spec/specs-go" ) // Device transforms a libcontainer configs.Device to a specs.LinuxDevice object. diff --git a/components/engine/oci/namespaces.go b/components/engine/oci/namespaces.go index f32e489b4a..5a2d8f2087 100644 --- a/components/engine/oci/namespaces.go +++ b/components/engine/oci/namespaces.go @@ -1,6 +1,6 @@ package oci // import "github.com/docker/docker/oci" -import specs "github.com/opencontainers/runtime-spec/specs-go" +import "github.com/opencontainers/runtime-spec/specs-go" // RemoveNamespace removes the `nsType` namespace from OCI spec `s` func RemoveNamespace(s *specs.Spec, nsType specs.LinuxNamespaceType) { diff --git a/components/engine/opts/address_pools.go b/components/engine/opts/address_pools.go index 99c89bb626..9b27a62853 100644 --- a/components/engine/opts/address_pools.go +++ b/components/engine/opts/address_pools.go @@ -65,7 +65,7 @@ func (p *PoolsOpt) Type() string { // String returns a string repr of this option func (p *PoolsOpt) String() string { - pools := []string{} + var pools []string for _, pool := range p.values { repr := fmt.Sprintf("%s %d", pool.Base, pool.Size) pools = append(pools, repr) diff --git a/components/engine/opts/opts.go b/components/engine/opts/opts.go index bfdcb996b0..de8aacb806 100644 --- a/components/engine/opts/opts.go +++ b/components/engine/opts/opts.go @@ -7,7 +7,7 @@ import ( "regexp" "strings" - units "github.com/docker/go-units" + "github.com/docker/go-units" ) var ( @@ -52,7 +52,7 @@ func (opts *ListOpts) Set(value string) error { } value = v } - (*opts.values) = append((*opts.values), value) + *opts.values = append(*opts.values, value) return nil } @@ -60,7 +60,7 @@ func (opts *ListOpts) Set(value string) error { func (opts *ListOpts) Delete(key string) { for i, k := range *opts.values { if k == key { - (*opts.values) = append((*opts.values)[:i], (*opts.values)[i+1:]...) + *opts.values = append((*opts.values)[:i], (*opts.values)[i+1:]...) return } } @@ -78,7 +78,7 @@ func (opts *ListOpts) GetMap() map[string]struct{} { // GetAll returns the values of slice. func (opts *ListOpts) GetAll() []string { - return (*opts.values) + return *opts.values } // GetAllOrEmpty returns the values of the slice @@ -103,7 +103,7 @@ func (opts *ListOpts) Get(key string) bool { // Len returns the amount of element in the slice. func (opts *ListOpts) Len() int { - return len((*opts.values)) + return len(*opts.values) } // Type returns a string name for this Option type diff --git a/components/engine/pkg/archive/changes_posix_test.go b/components/engine/pkg/archive/changes_posix_test.go index 76ee40bb60..019a0250f3 100644 --- a/components/engine/pkg/archive/changes_posix_test.go +++ b/components/engine/pkg/archive/changes_posix_test.go @@ -112,7 +112,7 @@ func (th tarHeaders) Less(i, j int) bool { return th[i].Name < th[j].Name } func walkHeaders(r io.Reader) ([]tar.Header, error) { t := tar.NewReader(r) - headers := []tar.Header{} + var headers []tar.Header for { hdr, err := t.Next() if err != nil { diff --git a/components/engine/pkg/archive/time_linux.go b/components/engine/pkg/archive/time_linux.go index 58aefe3efb..797143ee84 100644 --- a/components/engine/pkg/archive/time_linux.go +++ b/components/engine/pkg/archive/time_linux.go @@ -9,7 +9,7 @@ func timeToTimespec(time time.Time) (ts syscall.Timespec) { if time.IsZero() { // Return UTIME_OMIT special value ts.Sec = 0 - ts.Nsec = ((1 << 30) - 2) + ts.Nsec = (1 << 30) - 2 return } return syscall.NsecToTimespec(time.UnixNano()) diff --git a/components/engine/pkg/broadcaster/unbuffered_test.go b/components/engine/pkg/broadcaster/unbuffered_test.go index 2d885c77c1..c510584aa3 100644 --- a/components/engine/pkg/broadcaster/unbuffered_test.go +++ b/components/engine/pkg/broadcaster/unbuffered_test.go @@ -4,7 +4,6 @@ import ( "bytes" "errors" "strings" - "testing" ) diff --git a/components/engine/pkg/devicemapper/devmapper_wrapper.go b/components/engine/pkg/devicemapper/devmapper_wrapper.go index 8e28f642da..0b88f49695 100644 --- a/components/engine/pkg/devicemapper/devmapper_wrapper.go +++ b/components/engine/pkg/devicemapper/devmapper_wrapper.go @@ -216,7 +216,7 @@ func dmGetNextTargetFct(task *cdmTask, next unsafe.Pointer, start, length *uint6 } func dmUdevSetSyncSupportFct(syncWithUdev int) { - (C.dm_udev_set_sync_support(C.int(syncWithUdev))) + C.dm_udev_set_sync_support(C.int(syncWithUdev)) } func dmUdevGetSyncSupportFct() int { diff --git a/components/engine/pkg/idtools/idtools.go b/components/engine/pkg/idtools/idtools.go index e2b493158c..d1f173a311 100644 --- a/components/engine/pkg/idtools/idtools.go +++ b/components/engine/pkg/idtools/idtools.go @@ -30,8 +30,8 @@ func (e ranges) Swap(i, j int) { e[i], e[j] = e[j], e[i] } func (e ranges) Less(i, j int) bool { return e[i].Start < e[j].Start } const ( - subuidFileName string = "/etc/subuid" - subgidFileName string = "/etc/subgid" + subuidFileName = "/etc/subuid" + subgidFileName = "/etc/subgid" ) // MkdirAllAndChown creates a directory (include any along the path) and then modifies diff --git a/components/engine/pkg/jsonmessage/jsonmessage.go b/components/engine/pkg/jsonmessage/jsonmessage.go index 7e5c95b58b..dd95f36704 100644 --- a/components/engine/pkg/jsonmessage/jsonmessage.go +++ b/components/engine/pkg/jsonmessage/jsonmessage.go @@ -8,9 +8,9 @@ import ( "strings" "time" - gotty "github.com/Nvveen/Gotty" + "github.com/Nvveen/Gotty" "github.com/docker/docker/pkg/term" - units "github.com/docker/go-units" + "github.com/docker/go-units" ) // RFC3339NanoFixed is time.RFC3339Nano with nanoseconds padded using zeros to diff --git a/components/engine/pkg/pubsub/publisher_test.go b/components/engine/pkg/pubsub/publisher_test.go index 37bd6ece9d..98e158248f 100644 --- a/components/engine/pkg/pubsub/publisher_test.go +++ b/components/engine/pkg/pubsub/publisher_test.go @@ -20,7 +20,7 @@ func TestSendToOneSub(t *testing.T) { func TestSendToMultipleSubs(t *testing.T) { p := NewPublisher(100*time.Millisecond, 10) - subs := []chan interface{}{} + var subs []chan interface{} subs = append(subs, p.Subscribe(), p.Subscribe(), p.Subscribe()) p.Publish("hi") @@ -52,7 +52,7 @@ func TestEvictOneSub(t *testing.T) { func TestClosePublisher(t *testing.T) { p := NewPublisher(100*time.Millisecond, 10) - subs := []chan interface{}{} + var subs []chan interface{} subs = append(subs, p.Subscribe(), p.Subscribe(), p.Subscribe()) p.Close() @@ -99,7 +99,7 @@ func newTestSubscriber(p *Publisher) *testSubscriber { // for testing with -race func TestPubSubRace(t *testing.T) { p := NewPublisher(0, 1024) - var subs [](*testSubscriber) + var subs []*testSubscriber for j := 0; j < 50; j++ { subs = append(subs, newTestSubscriber(p)) } @@ -120,7 +120,7 @@ func BenchmarkPubSub(b *testing.B) { for i := 0; i < b.N; i++ { b.StopTimer() p := NewPublisher(0, 1024) - var subs [](*testSubscriber) + var subs []*testSubscriber for j := 0; j < 50; j++ { subs = append(subs, newTestSubscriber(p)) } diff --git a/components/engine/pkg/signal/signal.go b/components/engine/pkg/signal/signal.go index 6a663091a1..88ef7b5ea2 100644 --- a/components/engine/pkg/signal/signal.go +++ b/components/engine/pkg/signal/signal.go @@ -13,7 +13,7 @@ import ( // CatchAll catches all signals and relays them to the specified channel. func CatchAll(sigc chan os.Signal) { - handledSigs := []os.Signal{} + var handledSigs []os.Signal for _, s := range SignalMap { handledSigs = append(handledSigs, s) } diff --git a/components/engine/pkg/term/windows/windows.go b/components/engine/pkg/term/windows/windows.go index 1f8965969c..3e5593ca6a 100644 --- a/components/engine/pkg/term/windows/windows.go +++ b/components/engine/pkg/term/windows/windows.go @@ -9,7 +9,7 @@ import ( "os" "sync" - ansiterm "github.com/Azure/go-ansiterm" + "github.com/Azure/go-ansiterm" "github.com/sirupsen/logrus" ) diff --git a/components/engine/pkg/truncindex/truncindex_test.go b/components/engine/pkg/truncindex/truncindex_test.go index 5977ca315f..e259017982 100644 --- a/components/engine/pkg/truncindex/truncindex_test.go +++ b/components/engine/pkg/truncindex/truncindex_test.go @@ -10,7 +10,7 @@ import ( // Test the behavior of TruncIndex, an index for querying IDs from a non-conflicting prefix. func TestTruncIndex(t *testing.T) { - ids := []string{} + var ids []string index := NewTruncIndex(ids) // Get on an empty index if _, err := index.Get("foobar"); err == nil { diff --git a/components/engine/plugin/backend_linux.go b/components/engine/plugin/backend_linux.go index 4a6d80d243..044e14b0cb 100644 --- a/components/engine/plugin/backend_linux.go +++ b/components/engine/plugin/backend_linux.go @@ -33,7 +33,7 @@ import ( "github.com/docker/docker/pkg/system" "github.com/docker/docker/plugin/v2" refstore "github.com/docker/docker/reference" - digest "github.com/opencontainers/go-digest" + "github.com/opencontainers/go-digest" specs "github.com/opencontainers/image-spec/specs-go/v1" "github.com/pkg/errors" "github.com/sirupsen/logrus" diff --git a/components/engine/plugin/defs.go b/components/engine/plugin/defs.go index c158bbbfe5..31f7c6bcc3 100644 --- a/components/engine/plugin/defs.go +++ b/components/engine/plugin/defs.go @@ -5,7 +5,7 @@ import ( "github.com/docker/docker/pkg/plugins" "github.com/docker/docker/plugin/v2" - specs "github.com/opencontainers/runtime-spec/specs-go" + "github.com/opencontainers/runtime-spec/specs-go" ) // Store manages the plugin inventory in memory and on-disk diff --git a/components/engine/plugin/executor/containerd/containerd_test.go b/components/engine/plugin/executor/containerd/containerd_test.go index cd1a51bd35..d9185a05e1 100644 --- a/components/engine/plugin/executor/containerd/containerd_test.go +++ b/components/engine/plugin/executor/containerd/containerd_test.go @@ -10,7 +10,7 @@ import ( "github.com/docker/docker/libcontainerd" "github.com/gotestyourself/gotestyourself/assert" - specs "github.com/opencontainers/runtime-spec/specs-go" + "github.com/opencontainers/runtime-spec/specs-go" "github.com/pkg/errors" ) diff --git a/components/engine/plugin/manager.go b/components/engine/plugin/manager.go index 7595e7cbcc..9c674f9545 100644 --- a/components/engine/plugin/manager.go +++ b/components/engine/plugin/manager.go @@ -24,7 +24,7 @@ import ( "github.com/docker/docker/plugin/v2" "github.com/docker/docker/registry" "github.com/opencontainers/go-digest" - specs "github.com/opencontainers/runtime-spec/specs-go" + "github.com/opencontainers/runtime-spec/specs-go" "github.com/pkg/errors" "github.com/sirupsen/logrus" ) diff --git a/components/engine/plugin/manager_linux_test.go b/components/engine/plugin/manager_linux_test.go index 48048bb30f..d4199c80da 100644 --- a/components/engine/plugin/manager_linux_test.go +++ b/components/engine/plugin/manager_linux_test.go @@ -12,7 +12,7 @@ import ( "github.com/docker/docker/pkg/system" "github.com/docker/docker/plugin/v2" "github.com/gotestyourself/gotestyourself/skip" - specs "github.com/opencontainers/runtime-spec/specs-go" + "github.com/opencontainers/runtime-spec/specs-go" "github.com/pkg/errors" ) diff --git a/components/engine/plugin/store.go b/components/engine/plugin/store.go index 5cb994b759..8e96c11da4 100644 --- a/components/engine/plugin/store.go +++ b/components/engine/plugin/store.go @@ -9,7 +9,7 @@ import ( "github.com/docker/docker/pkg/plugingetter" "github.com/docker/docker/pkg/plugins" "github.com/docker/docker/plugin/v2" - specs "github.com/opencontainers/runtime-spec/specs-go" + "github.com/opencontainers/runtime-spec/specs-go" "github.com/pkg/errors" "github.com/sirupsen/logrus" ) @@ -18,13 +18,13 @@ import ( * When the time comes to remove support for V1 plugins, flipping * this bool is all that will be needed. */ -const allowV1PluginsFallback bool = true +const allowV1PluginsFallback = true /* defaultAPIVersion is the version of the plugin API for volume, network, IPAM and authz. This is a very stable API. When we update this API, then pluginType should include a version. e.g. "networkdriver/2.0". */ -const defaultAPIVersion string = "1.0" +const defaultAPIVersion = "1.0" // GetV2Plugin retrieves a plugin by name, id or partial ID. func (ps *Store) GetV2Plugin(refOrID string) (*v2.Plugin, error) { diff --git a/components/engine/plugin/v2/plugin.go b/components/engine/plugin/v2/plugin.go index 558e49d31b..1c451691ce 100644 --- a/components/engine/plugin/v2/plugin.go +++ b/components/engine/plugin/v2/plugin.go @@ -10,7 +10,7 @@ import ( "github.com/docker/docker/pkg/plugingetter" "github.com/docker/docker/pkg/plugins" "github.com/opencontainers/go-digest" - specs "github.com/opencontainers/runtime-spec/specs-go" + "github.com/opencontainers/runtime-spec/specs-go" ) // Plugin represents an individual plugin. diff --git a/components/engine/plugin/v2/plugin_linux.go b/components/engine/plugin/v2/plugin_linux.go index 4ad582cd83..58c432fcd6 100644 --- a/components/engine/plugin/v2/plugin_linux.go +++ b/components/engine/plugin/v2/plugin_linux.go @@ -9,7 +9,7 @@ import ( "github.com/docker/docker/api/types" "github.com/docker/docker/oci" "github.com/docker/docker/pkg/system" - specs "github.com/opencontainers/runtime-spec/specs-go" + "github.com/opencontainers/runtime-spec/specs-go" "github.com/pkg/errors" ) diff --git a/components/engine/reference/store_test.go b/components/engine/reference/store_test.go index 24c0597a3e..71f1d96e59 100644 --- a/components/engine/reference/store_test.go +++ b/components/engine/reference/store_test.go @@ -11,7 +11,7 @@ import ( "github.com/docker/distribution/reference" "github.com/gotestyourself/gotestyourself/assert" is "github.com/gotestyourself/gotestyourself/assert/cmp" - digest "github.com/opencontainers/go-digest" + "github.com/opencontainers/go-digest" ) var ( diff --git a/components/engine/registry/config_test.go b/components/engine/registry/config_test.go index 4df9cdb948..2f9c9548ea 100644 --- a/components/engine/registry/config_test.go +++ b/components/engine/registry/config_test.go @@ -100,7 +100,7 @@ func TestLoadAllowNondistributableArtifacts(t *testing.T) { t.Fatalf("expect no error, got '%s'", err) } - cidrStrs := []string{} + var cidrStrs []string for _, c := range config.AllowNondistributableArtifactsCIDRs { cidrStrs = append(cidrStrs, c.String()) } diff --git a/components/engine/registry/endpoint_v1.go b/components/engine/registry/endpoint_v1.go index 94c56dca7d..832fdb95a4 100644 --- a/components/engine/registry/endpoint_v1.go +++ b/components/engine/registry/endpoint_v1.go @@ -69,7 +69,7 @@ func validateEndpoint(endpoint *V1Endpoint) error { func newV1Endpoint(address url.URL, tlsConfig *tls.Config, userAgent string, metaHeaders http.Header) *V1Endpoint { endpoint := &V1Endpoint{ - IsSecure: (tlsConfig == nil || !tlsConfig.InsecureSkipVerify), + IsSecure: tlsConfig == nil || !tlsConfig.InsecureSkipVerify, URL: new(url.URL), } diff --git a/components/engine/registry/registry_mock_test.go b/components/engine/registry/registry_mock_test.go index e6a4fca0cc..bf17eb9fc7 100644 --- a/components/engine/registry/registry_mock_test.go +++ b/components/engine/registry/registry_mock_test.go @@ -430,7 +430,7 @@ func handlerImages(w http.ResponseWriter, r *http.Request) { writeResponse(w, "", 204) return } - images := []map[string]string{} + var images []map[string]string for imageID, layer := range testLayers { image := make(map[string]string) image["id"] = imageID diff --git a/components/engine/registry/registry_test.go b/components/engine/registry/registry_test.go index 86620dfccf..ec11252394 100644 --- a/components/engine/registry/registry_test.go +++ b/components/engine/registry/registry_test.go @@ -543,7 +543,7 @@ func TestNewIndexInfo(t *testing.T) { } config := emptyServiceConfig - noMirrors := []string{} + var noMirrors []string expectedIndexInfos := map[string]*registrytypes.IndexInfo{ IndexName: { Name: IndexName, diff --git a/components/engine/registry/session.go b/components/engine/registry/session.go index 1d0bae2ca7..ef14299594 100644 --- a/components/engine/registry/session.go +++ b/components/engine/registry/session.go @@ -3,7 +3,6 @@ package registry // import "github.com/docker/docker/registry" import ( "bytes" "crypto/sha256" - "sync" // this is required for some certificates _ "crypto/sha512" "encoding/hex" @@ -16,6 +15,7 @@ import ( "net/url" "strconv" "strings" + "sync" "github.com/docker/distribution/reference" "github.com/docker/distribution/registry/api/errcode" diff --git a/components/engine/volume/local/local.go b/components/engine/volume/local/local.go index b1eb2881b4..d97347423a 100644 --- a/components/engine/volume/local/local.go +++ b/components/engine/volume/local/local.go @@ -370,7 +370,7 @@ func getAddress(opts string) string { optsList := strings.Split(opts, ",") for i := 0; i < len(optsList); i++ { if strings.HasPrefix(optsList[i], "addr=") { - addr := (strings.SplitN(optsList[i], "=", 2)[1]) + addr := strings.SplitN(optsList[i], "=", 2)[1] return addr } } From 93d19d1ff6542896fdaa9d7ca479e9080a822ef6 Mon Sep 17 00:00:00 2001 From: Christian Muehlhaeuser Date: Wed, 23 May 2018 19:06:13 +0200 Subject: [PATCH 5/7] Bump go-systemd dependency to v17 Signed-off-by: Christian Muehlhaeuser Upstream-commit: 8991bac2e045b8cac4a289928ebb743e978bbfc5 Component: engine --- components/engine/vendor.conf | 2 +- .../github.com/coreos/go-systemd/NOTICE | 5 + .../github.com/coreos/go-systemd/README.md | 21 ++- .../coreos/go-systemd/activation/files.go | 19 +- .../coreos/go-systemd/activation/listeners.go | 51 +++++- .../go-systemd/activation/packetconns.go | 5 +- .../coreos/go-systemd/daemon/sdnotify.go | 39 +++- .../coreos/go-systemd/daemon/watchdog.go | 9 +- .../github.com/coreos/go-systemd/dbus/dbus.go | 31 +++- .../coreos/go-systemd/dbus/methods.go | 43 ++++- .../github.com/coreos/go-systemd/dbus/set.go | 2 +- .../coreos/go-systemd/dbus/subscription.go | 171 +++++++++++++----- .../coreos/go-systemd/journal/journal.go | 7 +- 13 files changed, 323 insertions(+), 82 deletions(-) create mode 100644 components/engine/vendor/github.com/coreos/go-systemd/NOTICE diff --git a/components/engine/vendor.conf b/components/engine/vendor.conf index 83695a31a0..5a945b145c 100644 --- a/components/engine/vendor.conf +++ b/components/engine/vendor.conf @@ -76,7 +76,7 @@ github.com/opencontainers/image-spec v1.0.1 github.com/seccomp/libseccomp-golang 32f571b70023028bd57d9288c20efbcb237f3ce0 # libcontainer deps (see src/github.com/opencontainers/runc/Godeps/Godeps.json) -github.com/coreos/go-systemd v15 +github.com/coreos/go-systemd v17 github.com/godbus/dbus v4.0.0 github.com/syndtr/gocapability 2c00daeb6c3b45114c80ac44119e7b8801fdd852 github.com/golang/protobuf 7a211bcf3bce0e3f1d74f9894916e6f116ae83b4 diff --git a/components/engine/vendor/github.com/coreos/go-systemd/NOTICE b/components/engine/vendor/github.com/coreos/go-systemd/NOTICE new file mode 100644 index 0000000000..23a0ada2fb --- /dev/null +++ b/components/engine/vendor/github.com/coreos/go-systemd/NOTICE @@ -0,0 +1,5 @@ +CoreOS Project +Copyright 2018 CoreOS, Inc + +This product includes software developed at CoreOS, Inc. +(http://www.coreos.com/). diff --git a/components/engine/vendor/github.com/coreos/go-systemd/README.md b/components/engine/vendor/github.com/coreos/go-systemd/README.md index cb87a11245..cad04a8035 100644 --- a/components/engine/vendor/github.com/coreos/go-systemd/README.md +++ b/components/engine/vendor/github.com/coreos/go-systemd/README.md @@ -6,9 +6,11 @@ Go bindings to systemd. The project has several packages: - `activation` - for writing and using socket activation from Go +- `daemon` - for notifying systemd of service status changes - `dbus` - for starting/stopping/inspecting running services and units - `journal` - for writing to systemd's logging service, journald - `sdjournal` - for reading from journald by wrapping its C API +- `login1` - for integration with the systemd logind API - `machine1` - for registering machines/containers with systemd - `unit` - for (de)serialization and comparison of unit files @@ -18,10 +20,9 @@ An example HTTP server using socket activation can be quickly set up by followin https://github.com/coreos/go-systemd/tree/master/examples/activation/httpserver -## Journal +## systemd Service Notification -Using the pure-Go `journal` package you can submit journal entries directly to systemd's journal, taking advantage of features like indexed key/value pairs for each log entry. -The `sdjournal` package provides read access to the journal by wrapping around journald's native C API; consequently it requires cgo and the journal headers to be available. +The `daemon` package is an implementation of the [sd_notify protocol](https://www.freedesktop.org/software/systemd/man/sd_notify.html#Description). It can be used to inform systemd of service start-up completion, watchdog events, and other status changes. ## D-Bus @@ -45,6 +46,20 @@ Create `/etc/dbus-1/system-local.conf` that looks like this: ``` +## Journal + +### Writing to the Journal + +Using the pure-Go `journal` package you can submit journal entries directly to systemd's journal, taking advantage of features like indexed key/value pairs for each log entry. + +### Reading from the Journal + +The `sdjournal` package provides read access to the journal by wrapping around journald's native C API; consequently it requires cgo and the journal headers to be available. + +## logind + +The `login1` package provides functions to integrate with the [systemd logind API](http://www.freedesktop.org/wiki/Software/systemd/logind/). + ## machined The `machine1` package allows interaction with the [systemd machined D-Bus API](http://www.freedesktop.org/wiki/Software/systemd/machined/). diff --git a/components/engine/vendor/github.com/coreos/go-systemd/activation/files.go b/components/engine/vendor/github.com/coreos/go-systemd/activation/files.go index c8e85fcd58..29dd18defa 100644 --- a/components/engine/vendor/github.com/coreos/go-systemd/activation/files.go +++ b/components/engine/vendor/github.com/coreos/go-systemd/activation/files.go @@ -18,18 +18,26 @@ package activation import ( "os" "strconv" + "strings" "syscall" ) -// based on: https://gist.github.com/alberts/4640792 const ( + // listenFdsStart corresponds to `SD_LISTEN_FDS_START`. listenFdsStart = 3 ) +// Files returns a slice containing a `os.File` object for each +// file descriptor passed to this process via systemd fd-passing protocol. +// +// The order of the file descriptors is preserved in the returned slice. +// `unsetEnv` is typically set to `true` in order to avoid clashes in +// fd usage and to avoid leaking environment flags to child processes. func Files(unsetEnv bool) []*os.File { if unsetEnv { defer os.Unsetenv("LISTEN_PID") defer os.Unsetenv("LISTEN_FDS") + defer os.Unsetenv("LISTEN_FDNAMES") } pid, err := strconv.Atoi(os.Getenv("LISTEN_PID")) @@ -42,10 +50,17 @@ func Files(unsetEnv bool) []*os.File { return nil } + names := strings.Split(os.Getenv("LISTEN_FDNAMES"), ":") + files := make([]*os.File, 0, nfds) for fd := listenFdsStart; fd < listenFdsStart+nfds; fd++ { syscall.CloseOnExec(fd) - files = append(files, os.NewFile(uintptr(fd), "LISTEN_FD_"+strconv.Itoa(fd))) + name := "LISTEN_FD_" + strconv.Itoa(fd) + offset := fd - listenFdsStart + if offset < len(names) && len(names[offset]) > 0 { + name = names[offset] + } + files = append(files, os.NewFile(uintptr(fd), name)) } return files diff --git a/components/engine/vendor/github.com/coreos/go-systemd/activation/listeners.go b/components/engine/vendor/github.com/coreos/go-systemd/activation/listeners.go index fd5dfc709c..bb5cc2311e 100644 --- a/components/engine/vendor/github.com/coreos/go-systemd/activation/listeners.go +++ b/components/engine/vendor/github.com/coreos/go-systemd/activation/listeners.go @@ -25,13 +25,33 @@ import ( // The order of the file descriptors is preserved in the returned slice. // Nil values are used to fill any gaps. For example if systemd were to return file descriptors // corresponding with "udp, tcp, tcp", then the slice would contain {nil, net.Listener, net.Listener} -func Listeners(unsetEnv bool) ([]net.Listener, error) { - files := Files(unsetEnv) +func Listeners() ([]net.Listener, error) { + files := Files(true) listeners := make([]net.Listener, len(files)) for i, f := range files { if pc, err := net.FileListener(f); err == nil { listeners[i] = pc + f.Close() + } + } + return listeners, nil +} + +// ListenersWithNames maps a listener name to a set of net.Listener instances. +func ListenersWithNames() (map[string][]net.Listener, error) { + files := Files(true) + listeners := map[string][]net.Listener{} + + for _, f := range files { + if pc, err := net.FileListener(f); err == nil { + current, ok := listeners[f.Name()] + if !ok { + listeners[f.Name()] = []net.Listener{pc} + } else { + listeners[f.Name()] = append(current, pc) + } + f.Close() } } return listeners, nil @@ -40,8 +60,8 @@ func Listeners(unsetEnv bool) ([]net.Listener, error) { // TLSListeners returns a slice containing a net.listener for each matching TCP socket type // passed to this process. // It uses default Listeners func and forces TCP sockets handlers to use TLS based on tlsConfig. -func TLSListeners(unsetEnv bool, tlsConfig *tls.Config) ([]net.Listener, error) { - listeners, err := Listeners(unsetEnv) +func TLSListeners(tlsConfig *tls.Config) ([]net.Listener, error) { + listeners, err := Listeners() if listeners == nil || err != nil { return nil, err @@ -58,3 +78,26 @@ func TLSListeners(unsetEnv bool, tlsConfig *tls.Config) ([]net.Listener, error) return listeners, err } + +// TLSListenersWithNames maps a listener name to a net.Listener with +// the associated TLS configuration. +func TLSListenersWithNames(tlsConfig *tls.Config) (map[string][]net.Listener, error) { + listeners, err := ListenersWithNames() + + if listeners == nil || err != nil { + return nil, err + } + + if tlsConfig != nil && err == nil { + for _, ll := range listeners { + // Activate TLS only for TCP sockets + for i, l := range ll { + if l.Addr().Network() == "tcp" { + ll[i] = tls.NewListener(l, tlsConfig) + } + } + } + } + + return listeners, err +} diff --git a/components/engine/vendor/github.com/coreos/go-systemd/activation/packetconns.go b/components/engine/vendor/github.com/coreos/go-systemd/activation/packetconns.go index 48b2ca029d..a97206785a 100644 --- a/components/engine/vendor/github.com/coreos/go-systemd/activation/packetconns.go +++ b/components/engine/vendor/github.com/coreos/go-systemd/activation/packetconns.go @@ -24,13 +24,14 @@ import ( // The order of the file descriptors is preserved in the returned slice. // Nil values are used to fill any gaps. For example if systemd were to return file descriptors // corresponding with "udp, tcp, udp", then the slice would contain {net.PacketConn, nil, net.PacketConn} -func PacketConns(unsetEnv bool) ([]net.PacketConn, error) { - files := Files(unsetEnv) +func PacketConns() ([]net.PacketConn, error) { + files := Files(true) conns := make([]net.PacketConn, len(files)) for i, f := range files { if pc, err := net.FilePacketConn(f); err == nil { conns[i] = pc + f.Close() } } return conns, nil diff --git a/components/engine/vendor/github.com/coreos/go-systemd/daemon/sdnotify.go b/components/engine/vendor/github.com/coreos/go-systemd/daemon/sdnotify.go index ba6d41d85b..ba4ae31f19 100644 --- a/components/engine/vendor/github.com/coreos/go-systemd/daemon/sdnotify.go +++ b/components/engine/vendor/github.com/coreos/go-systemd/daemon/sdnotify.go @@ -1,4 +1,5 @@ // Copyright 2014 Docker, Inc. +// Copyright 2015-2018 CoreOS, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -13,7 +14,11 @@ // limitations under the License. // -// Code forked from Docker project +// Package daemon provides a Go implementation of the sd_notify protocol. +// It can be used to inform systemd of service start-up completion, watchdog +// events, and other status changes. +// +// https://www.freedesktop.org/software/systemd/man/sd_notify.html#Description package daemon import ( @@ -21,6 +26,25 @@ import ( "os" ) +const ( + // SdNotifyReady tells the service manager that service startup is finished + // or the service finished loading its configuration. + SdNotifyReady = "READY=1" + + // SdNotifyStopping tells the service manager that the service is beginning + // its shutdown. + SdNotifyStopping = "STOPPING=1" + + // SdNotifyReloading tells the service manager that this service is + // reloading its configuration. Note that you must call SdNotifyReady when + // it completed reloading. + SdNotifyReloading = "RELOADING=1" + + // SdNotifyWatchdog tells the service manager to update the watchdog + // timestamp for the service. + SdNotifyWatchdog = "WATCHDOG=1" +) + // SdNotify sends a message to the init daemon. It is common to ignore the error. // If `unsetEnvironment` is true, the environment variable `NOTIFY_SOCKET` // will be unconditionally unset. @@ -29,7 +53,7 @@ import ( // (false, nil) - notification not supported (i.e. NOTIFY_SOCKET is unset) // (false, err) - notification supported, but failure happened (e.g. error connecting to NOTIFY_SOCKET or while sending data) // (true, nil) - notification supported, data has been sent -func SdNotify(unsetEnvironment bool, state string) (sent bool, err error) { +func SdNotify(unsetEnvironment bool, state string) (bool, error) { socketAddr := &net.UnixAddr{ Name: os.Getenv("NOTIFY_SOCKET"), Net: "unixgram", @@ -41,10 +65,9 @@ func SdNotify(unsetEnvironment bool, state string) (sent bool, err error) { } if unsetEnvironment { - err = os.Unsetenv("NOTIFY_SOCKET") - } - if err != nil { - return false, err + if err := os.Unsetenv("NOTIFY_SOCKET"); err != nil { + return false, err + } } conn, err := net.DialUnix(socketAddr.Net, nil, socketAddr) @@ -54,9 +77,7 @@ func SdNotify(unsetEnvironment bool, state string) (sent bool, err error) { } defer conn.Close() - _, err = conn.Write([]byte(state)) - // Error sending the message - if err != nil { + if _, err = conn.Write([]byte(state)); err != nil { return false, err } return true, nil diff --git a/components/engine/vendor/github.com/coreos/go-systemd/daemon/watchdog.go b/components/engine/vendor/github.com/coreos/go-systemd/daemon/watchdog.go index 35a92e6e67..7a0e0d3a51 100644 --- a/components/engine/vendor/github.com/coreos/go-systemd/daemon/watchdog.go +++ b/components/engine/vendor/github.com/coreos/go-systemd/daemon/watchdog.go @@ -21,10 +21,11 @@ import ( "time" ) -// SdWatchdogEnabled return watchdog information for a service. -// Process should send daemon.SdNotify("WATCHDOG=1") every time / 2. -// If `unsetEnvironment` is true, the environment variables `WATCHDOG_USEC` -// and `WATCHDOG_PID` will be unconditionally unset. +// SdWatchdogEnabled returns watchdog information for a service. +// Processes should call daemon.SdNotify(false, daemon.SdNotifyWatchdog) every +// time / 2. +// If `unsetEnvironment` is true, the environment variables `WATCHDOG_USEC` and +// `WATCHDOG_PID` will be unconditionally unset. // // It returns one of the following: // (0, nil) - watchdog isn't enabled or we aren't the watched PID. diff --git a/components/engine/vendor/github.com/coreos/go-systemd/dbus/dbus.go b/components/engine/vendor/github.com/coreos/go-systemd/dbus/dbus.go index c1694fb522..1d54810aff 100644 --- a/components/engine/vendor/github.com/coreos/go-systemd/dbus/dbus.go +++ b/components/engine/vendor/github.com/coreos/go-systemd/dbus/dbus.go @@ -16,6 +16,7 @@ package dbus import ( + "encoding/hex" "fmt" "os" "strconv" @@ -60,6 +61,27 @@ func PathBusEscape(path string) string { return string(n) } +// pathBusUnescape is the inverse of PathBusEscape. +func pathBusUnescape(path string) string { + if path == "_" { + return "" + } + n := []byte{} + for i := 0; i < len(path); i++ { + c := path[i] + if c == '_' && i+2 < len(path) { + res, err := hex.DecodeString(path[i+1 : i+3]) + if err == nil { + n = append(n, res...) + } + i += 2 + } else { + n = append(n, c) + } + } + return string(n) +} + // Conn is a connection to systemd's dbus endpoint. type Conn struct { // sysconn/sysobj are only used to call dbus methods @@ -74,13 +96,18 @@ type Conn struct { jobs map[dbus.ObjectPath]chan<- string sync.Mutex } - subscriber struct { + subStateSubscriber struct { updateCh chan<- *SubStateUpdate errCh chan<- error sync.Mutex ignore map[dbus.ObjectPath]int64 cleanIgnore int64 } + propertiesSubscriber struct { + updateCh chan<- *PropertiesUpdate + errCh chan<- error + sync.Mutex + } } // New establishes a connection to any available bus and authenticates. @@ -152,7 +179,7 @@ func NewConnection(dialBus func() (*dbus.Conn, error)) (*Conn, error) { sigobj: systemdObject(sigconn), } - c.subscriber.ignore = make(map[dbus.ObjectPath]int64) + c.subStateSubscriber.ignore = make(map[dbus.ObjectPath]int64) c.jobListener.jobs = make(map[dbus.ObjectPath]chan<- string) // Setup the listeners on jobs so that we can get completions diff --git a/components/engine/vendor/github.com/coreos/go-systemd/dbus/methods.go b/components/engine/vendor/github.com/coreos/go-systemd/dbus/methods.go index ab17f7cc75..0b4207229f 100644 --- a/components/engine/vendor/github.com/coreos/go-systemd/dbus/methods.go +++ b/components/engine/vendor/github.com/coreos/go-systemd/dbus/methods.go @@ -1,4 +1,4 @@ -// Copyright 2015 CoreOS, Inc. +// Copyright 2015, 2018 CoreOS, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -16,6 +16,7 @@ package dbus import ( "errors" + "fmt" "path" "strconv" @@ -148,14 +149,27 @@ func (c *Conn) ResetFailedUnit(name string) error { return c.sysobj.Call("org.freedesktop.systemd1.Manager.ResetFailedUnit", 0, name).Store() } -// getProperties takes the unit name and returns all of its dbus object properties, for the given dbus interface -func (c *Conn) getProperties(unit string, dbusInterface string) (map[string]interface{}, error) { +// SystemState returns the systemd state. Equivalent to `systemctl is-system-running`. +func (c *Conn) SystemState() (*Property, error) { + var err error + var prop dbus.Variant + + obj := c.sysconn.Object("org.freedesktop.systemd1", "/org/freedesktop/systemd1") + err = obj.Call("org.freedesktop.DBus.Properties.Get", 0, "org.freedesktop.systemd1.Manager", "SystemState").Store(&prop) + if err != nil { + return nil, err + } + + return &Property{Name: "SystemState", Value: prop}, nil +} + +// getProperties takes the unit path and returns all of its dbus object properties, for the given dbus interface +func (c *Conn) getProperties(path dbus.ObjectPath, dbusInterface string) (map[string]interface{}, error) { var err error var props map[string]dbus.Variant - path := unitPath(unit) if !path.IsValid() { - return nil, errors.New("invalid unit name: " + unit) + return nil, fmt.Errorf("invalid unit name: %v", path) } obj := c.sysconn.Object("org.freedesktop.systemd1", path) @@ -172,9 +186,15 @@ func (c *Conn) getProperties(unit string, dbusInterface string) (map[string]inte return out, nil } -// GetUnitProperties takes the unit name and returns all of its dbus object properties. +// GetUnitProperties takes the (unescaped) unit name and returns all of its dbus object properties. func (c *Conn) GetUnitProperties(unit string) (map[string]interface{}, error) { - return c.getProperties(unit, "org.freedesktop.systemd1.Unit") + path := unitPath(unit) + return c.getProperties(path, "org.freedesktop.systemd1.Unit") +} + +// GetUnitProperties takes the (escaped) unit path and returns all of its dbus object properties. +func (c *Conn) GetUnitPathProperties(path dbus.ObjectPath) (map[string]interface{}, error) { + return c.getProperties(path, "org.freedesktop.systemd1.Unit") } func (c *Conn) getProperty(unit string, dbusInterface string, propertyName string) (*Property, error) { @@ -208,7 +228,8 @@ func (c *Conn) GetServiceProperty(service string, propertyName string) (*Propert // Valid values for unitType: Service, Socket, Target, Device, Mount, Automount, Snapshot, Timer, Swap, Path, Slice, Scope // return "dbus.Error: Unknown interface" if the unitType is not the correct type of the unit func (c *Conn) GetUnitTypeProperties(unit string, unitType string) (map[string]interface{}, error) { - return c.getProperties(unit, "org.freedesktop.systemd1."+unitType) + path := unitPath(unit) + return c.getProperties(path, "org.freedesktop.systemd1."+unitType) } // SetUnitProperties() may be used to modify certain unit properties at runtime. @@ -292,6 +313,7 @@ func (c *Conn) ListUnitsByPatterns(states []string, patterns []string) ([]UnitSt // names and returns an UnitStatus array. Comparing to ListUnitsByPatterns // method, this method returns statuses even for inactive or non-existing // units. Input array should contain exact unit names, but not patterns. +// Note: Requires systemd v230 or higher func (c *Conn) ListUnitsByNames(units []string) ([]UnitStatus, error) { return c.listUnitsInternal(c.sysobj.Call("org.freedesktop.systemd1.Manager.ListUnitsByNames", 0, units).Store) } @@ -563,3 +585,8 @@ func (c *Conn) Reload() error { func unitPath(name string) dbus.ObjectPath { return dbus.ObjectPath("/org/freedesktop/systemd1/unit/" + PathBusEscape(name)) } + +// unitName returns the unescaped base element of the supplied escaped path +func unitName(dpath dbus.ObjectPath) string { + return pathBusUnescape(path.Base(string(dpath))) +} diff --git a/components/engine/vendor/github.com/coreos/go-systemd/dbus/set.go b/components/engine/vendor/github.com/coreos/go-systemd/dbus/set.go index f92e6fbed1..17c5d48565 100644 --- a/components/engine/vendor/github.com/coreos/go-systemd/dbus/set.go +++ b/components/engine/vendor/github.com/coreos/go-systemd/dbus/set.go @@ -36,7 +36,7 @@ func (s *set) Length() int { } func (s *set) Values() (values []string) { - for val, _ := range s.data { + for val := range s.data { values = append(values, val) } return diff --git a/components/engine/vendor/github.com/coreos/go-systemd/dbus/subscription.go b/components/engine/vendor/github.com/coreos/go-systemd/dbus/subscription.go index 996451445c..70e63a6f16 100644 --- a/components/engine/vendor/github.com/coreos/go-systemd/dbus/subscription.go +++ b/components/engine/vendor/github.com/coreos/go-systemd/dbus/subscription.go @@ -16,6 +16,7 @@ package dbus import ( "errors" + "log" "time" "github.com/godbus/dbus" @@ -36,22 +37,12 @@ func (c *Conn) Subscribe() error { c.sigconn.BusObject().Call("org.freedesktop.DBus.AddMatch", 0, "type='signal',interface='org.freedesktop.DBus.Properties',member='PropertiesChanged'") - err := c.sigobj.Call("org.freedesktop.systemd1.Manager.Subscribe", 0).Store() - if err != nil { - return err - } - - return nil + return c.sigobj.Call("org.freedesktop.systemd1.Manager.Subscribe", 0).Store() } // Unsubscribe this connection from systemd dbus events. func (c *Conn) Unsubscribe() error { - err := c.sigobj.Call("org.freedesktop.systemd1.Manager.Unsubscribe", 0).Store() - if err != nil { - return err - } - - return nil + return c.sigobj.Call("org.freedesktop.systemd1.Manager.Unsubscribe", 0).Store() } func (c *Conn) dispatch() { @@ -70,7 +61,8 @@ func (c *Conn) dispatch() { c.jobComplete(signal) } - if c.subscriber.updateCh == nil { + if c.subStateSubscriber.updateCh == nil && + c.propertiesSubscriber.updateCh == nil { continue } @@ -84,6 +76,12 @@ func (c *Conn) dispatch() { case "org.freedesktop.DBus.Properties.PropertiesChanged": if signal.Body[0].(string) == "org.freedesktop.systemd1.Unit" { unitPath = signal.Path + + if len(signal.Body) >= 2 { + if changed, ok := signal.Body[1].(map[string]dbus.Variant); ok { + c.sendPropertiesUpdate(unitPath, changed) + } + } } } @@ -169,42 +167,80 @@ type SubStateUpdate struct { // is full, it attempts to write an error to errCh; if errCh is full, the error // passes silently. func (c *Conn) SetSubStateSubscriber(updateCh chan<- *SubStateUpdate, errCh chan<- error) { - c.subscriber.Lock() - defer c.subscriber.Unlock() - c.subscriber.updateCh = updateCh - c.subscriber.errCh = errCh -} - -func (c *Conn) sendSubStateUpdate(path dbus.ObjectPath) { - c.subscriber.Lock() - defer c.subscriber.Unlock() - - if c.shouldIgnore(path) { + if c == nil { + msg := "nil receiver" + select { + case errCh <- errors.New(msg): + default: + log.Printf("full error channel while reporting: %s\n", msg) + } return } - info, err := c.GetUnitProperties(string(path)) - if err != nil { - select { - case c.subscriber.errCh <- err: - default: - } + c.subStateSubscriber.Lock() + defer c.subStateSubscriber.Unlock() + c.subStateSubscriber.updateCh = updateCh + c.subStateSubscriber.errCh = errCh +} + +func (c *Conn) sendSubStateUpdate(unitPath dbus.ObjectPath) { + c.subStateSubscriber.Lock() + defer c.subStateSubscriber.Unlock() + + if c.subStateSubscriber.updateCh == nil { + return } - name := info["Id"].(string) - substate := info["SubState"].(string) + isIgnored := c.shouldIgnore(unitPath) + defer c.cleanIgnore() + if isIgnored { + return + } + + info, err := c.GetUnitPathProperties(unitPath) + if err != nil { + select { + case c.subStateSubscriber.errCh <- err: + default: + log.Printf("full error channel while reporting: %s\n", err) + } + return + } + defer c.updateIgnore(unitPath, info) + + name, ok := info["Id"].(string) + if !ok { + msg := "failed to cast info.Id" + select { + case c.subStateSubscriber.errCh <- errors.New(msg): + default: + log.Printf("full error channel while reporting: %s\n", err) + } + return + } + substate, ok := info["SubState"].(string) + if !ok { + msg := "failed to cast info.SubState" + select { + case c.subStateSubscriber.errCh <- errors.New(msg): + default: + log.Printf("full error channel while reporting: %s\n", msg) + } + return + } update := &SubStateUpdate{name, substate} select { - case c.subscriber.updateCh <- update: + case c.subStateSubscriber.updateCh <- update: default: + msg := "update channel is full" select { - case c.subscriber.errCh <- errors.New("update channel full!"): + case c.subStateSubscriber.errCh <- errors.New(msg): default: + log.Printf("full error channel while reporting: %s\n", msg) } + return } - - c.updateIgnore(path, info) } // The ignore functions work around a wart in the systemd dbus interface. @@ -222,29 +258,76 @@ func (c *Conn) sendSubStateUpdate(path dbus.ObjectPath) { // the properties). func (c *Conn) shouldIgnore(path dbus.ObjectPath) bool { - t, ok := c.subscriber.ignore[path] + t, ok := c.subStateSubscriber.ignore[path] return ok && t >= time.Now().UnixNano() } func (c *Conn) updateIgnore(path dbus.ObjectPath, info map[string]interface{}) { - c.cleanIgnore() + loadState, ok := info["LoadState"].(string) + if !ok { + return + } // unit is unloaded - it will trigger bad systemd dbus behavior - if info["LoadState"].(string) == "not-found" { - c.subscriber.ignore[path] = time.Now().UnixNano() + ignoreInterval + if loadState == "not-found" { + c.subStateSubscriber.ignore[path] = time.Now().UnixNano() + ignoreInterval } } // without this, ignore would grow unboundedly over time func (c *Conn) cleanIgnore() { now := time.Now().UnixNano() - if c.subscriber.cleanIgnore < now { - c.subscriber.cleanIgnore = now + cleanIgnoreInterval + if c.subStateSubscriber.cleanIgnore < now { + c.subStateSubscriber.cleanIgnore = now + cleanIgnoreInterval - for p, t := range c.subscriber.ignore { + for p, t := range c.subStateSubscriber.ignore { if t < now { - delete(c.subscriber.ignore, p) + delete(c.subStateSubscriber.ignore, p) } } } } + +// PropertiesUpdate holds a map of a unit's changed properties +type PropertiesUpdate struct { + UnitName string + Changed map[string]dbus.Variant +} + +// SetPropertiesSubscriber writes to updateCh when any unit's properties +// change. Every property change reported by systemd will be sent; that is, no +// transitions will be "missed" (as they might be with SetSubStateSubscriber). +// However, state changes will only be written to the channel with non-blocking +// writes. If updateCh is full, it attempts to write an error to errCh; if +// errCh is full, the error passes silently. +func (c *Conn) SetPropertiesSubscriber(updateCh chan<- *PropertiesUpdate, errCh chan<- error) { + c.propertiesSubscriber.Lock() + defer c.propertiesSubscriber.Unlock() + c.propertiesSubscriber.updateCh = updateCh + c.propertiesSubscriber.errCh = errCh +} + +// we don't need to worry about shouldIgnore() here because +// sendPropertiesUpdate doesn't call GetProperties() +func (c *Conn) sendPropertiesUpdate(unitPath dbus.ObjectPath, changedProps map[string]dbus.Variant) { + c.propertiesSubscriber.Lock() + defer c.propertiesSubscriber.Unlock() + + if c.propertiesSubscriber.updateCh == nil { + return + } + + update := &PropertiesUpdate{unitName(unitPath), changedProps} + + select { + case c.propertiesSubscriber.updateCh <- update: + default: + msg := "update channel is full" + select { + case c.propertiesSubscriber.errCh <- errors.New(msg): + default: + log.Printf("full error channel while reporting: %s\n", msg) + } + return + } +} diff --git a/components/engine/vendor/github.com/coreos/go-systemd/journal/journal.go b/components/engine/vendor/github.com/coreos/go-systemd/journal/journal.go index 7f434990d2..ef85a3ba24 100644 --- a/components/engine/vendor/github.com/coreos/go-systemd/journal/journal.go +++ b/components/engine/vendor/github.com/coreos/go-systemd/journal/journal.go @@ -103,7 +103,10 @@ func Send(message string, priority Priority, vars map[string]string) error { if !ok { return journalError("can't send file through non-Unix connection") } - unixConn.WriteMsgUnix([]byte{}, rights, nil) + _, _, err = unixConn.WriteMsgUnix([]byte{}, rights, nil) + if err != nil { + return journalError(err.Error()) + } } else if err != nil { return journalError(err.Error()) } @@ -165,7 +168,7 @@ func tempFd() (*os.File, error) { if err != nil { return nil, err } - syscall.Unlink(file.Name()) + err = syscall.Unlink(file.Name()) if err != nil { return nil, err } From 33e8d89a75e57b07ab71aab4dcd2cc6bff3b684e Mon Sep 17 00:00:00 2001 From: Christian Muehlhaeuser Date: Wed, 23 May 2018 19:06:34 +0200 Subject: [PATCH 6/7] Use go-systemd const instead of magic string in Linux version of dockerd Signed-off-by: Christian Muehlhaeuser Upstream-commit: d393774a53e0a45486047a80ca4ae8faf5599386 Component: engine --- components/engine/cmd/dockerd/daemon_linux.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/engine/cmd/dockerd/daemon_linux.go b/components/engine/cmd/dockerd/daemon_linux.go index b09fed9293..cf2d65275f 100644 --- a/components/engine/cmd/dockerd/daemon_linux.go +++ b/components/engine/cmd/dockerd/daemon_linux.go @@ -9,5 +9,5 @@ func preNotifySystem() { // notifySystem sends a message to the host when the server is ready to be used func notifySystem() { // Tell the init daemon we are accepting requests - go systemdDaemon.SdNotify(false, "READY=1") + go systemdDaemon.SdNotify(false, systemdDaemon.SdNotifyReady) } From 75bf6c61a86d2ff132e5de09c5ca3ebf36a8ecc7 Mon Sep 17 00:00:00 2001 From: Christian Muehlhaeuser Date: Wed, 23 May 2018 21:57:30 +0200 Subject: [PATCH 7/7] Adapt listeners to upstream API changes in go-systemd Signed-off-by: Christian Muehlhaeuser Upstream-commit: 703c3c573599e20e1059d18f74cb4a05647587ae Component: engine --- components/engine/daemon/listeners/listeners_linux.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/engine/daemon/listeners/listeners_linux.go b/components/engine/daemon/listeners/listeners_linux.go index b0174bc6ee..c8956db258 100644 --- a/components/engine/daemon/listeners/listeners_linux.go +++ b/components/engine/daemon/listeners/listeners_linux.go @@ -62,9 +62,9 @@ func listenFD(addr string, tlsConfig *tls.Config) ([]net.Listener, error) { ) // socket activation if tlsConfig != nil { - listeners, err = activation.TLSListeners(false, tlsConfig) + listeners, err = activation.TLSListeners(tlsConfig) } else { - listeners, err = activation.Listeners(false) + listeners, err = activation.Listeners() } if err != nil { return nil, err