Various code-cleanup
remove unnescessary import aliases, brackets, and so on. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
0846a02d54
commit
f23c00d870
112 changed files with 168 additions and 182 deletions
|
@ -3,9 +3,9 @@ package api // import "github.com/docker/docker/api"
|
||||||
// Common constants for daemon and client.
|
// Common constants for daemon and client.
|
||||||
const (
|
const (
|
||||||
// DefaultVersion of Current REST API
|
// DefaultVersion of Current REST API
|
||||||
DefaultVersion string = "1.37"
|
DefaultVersion = "1.37"
|
||||||
|
|
||||||
// NoBaseImageSpecifier is the symbol used by the FROM
|
// NoBaseImageSpecifier is the symbol used by the FROM
|
||||||
// command to specify that no base image is to be used.
|
// command to specify that no base image is to be used.
|
||||||
NoBaseImageSpecifier string = "scratch"
|
NoBaseImageSpecifier = "scratch"
|
||||||
)
|
)
|
||||||
|
|
|
@ -3,4 +3,4 @@
|
||||||
package api // import "github.com/docker/docker/api"
|
package api // import "github.com/docker/docker/api"
|
||||||
|
|
||||||
// MinVersion represents Minimum REST API version supported
|
// MinVersion represents Minimum REST API version supported
|
||||||
const MinVersion string = "1.12"
|
const MinVersion = "1.12"
|
||||||
|
|
|
@ -23,7 +23,7 @@ import (
|
||||||
"github.com/docker/docker/pkg/progress"
|
"github.com/docker/docker/pkg/progress"
|
||||||
"github.com/docker/docker/pkg/streamformatter"
|
"github.com/docker/docker/pkg/streamformatter"
|
||||||
"github.com/docker/docker/pkg/system"
|
"github.com/docker/docker/pkg/system"
|
||||||
units "github.com/docker/go-units"
|
"github.com/docker/go-units"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,13 +1,12 @@
|
||||||
package server // import "github.com/docker/docker/api/server"
|
package server // import "github.com/docker/docker/api/server"
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/http/httptest"
|
"net/http/httptest"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"context"
|
|
||||||
|
|
||||||
"github.com/docker/docker/api"
|
"github.com/docker/docker/api"
|
||||||
"github.com/docker/docker/api/server/httputils"
|
"github.com/docker/docker/api/server/httputils"
|
||||||
"github.com/docker/docker/api/server/middleware"
|
"github.com/docker/docker/api/server/middleware"
|
||||||
|
|
|
@ -7,7 +7,7 @@ import (
|
||||||
|
|
||||||
"github.com/docker/docker/api/types/container"
|
"github.com/docker/docker/api/types/container"
|
||||||
"github.com/docker/docker/api/types/filters"
|
"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
|
// CheckpointCreateOptions holds parameters to create a checkpoint from a container
|
||||||
|
|
|
@ -19,7 +19,7 @@ import (
|
||||||
|
|
||||||
const (
|
const (
|
||||||
// DefaultDockerfileName is the Default filename with Docker commands, read by docker build
|
// 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
|
// Source defines a location that can be used as a source for the ADD/COPY
|
||||||
|
|
|
@ -69,7 +69,7 @@ func (b *BuildArgs) MergeReferencedArgs(other *BuildArgs) {
|
||||||
// WarnOnUnusedBuildArgs checks if there are any leftover build-args that were
|
// WarnOnUnusedBuildArgs checks if there are any leftover build-args that were
|
||||||
// passed but not consumed during build. Print a warning, if there are any.
|
// passed but not consumed during build. Print a warning, if there are any.
|
||||||
func (b *BuildArgs) WarnOnUnusedBuildArgs(out io.Writer) {
|
func (b *BuildArgs) WarnOnUnusedBuildArgs(out io.Writer) {
|
||||||
leftoverArgs := []string{}
|
var leftoverArgs []string
|
||||||
for arg := range b.argsFromOptions {
|
for arg := range b.argsFromOptions {
|
||||||
_, isReferenced := b.referencedArgs[arg]
|
_, isReferenced := b.referencedArgs[arg]
|
||||||
_, isBuiltin := builtinAllowedBuildArgs[arg]
|
_, isBuiltin := builtinAllowedBuildArgs[arg]
|
||||||
|
|
|
@ -387,7 +387,7 @@ func BuildFromConfig(config *container.Config, changes []string, os string) (*co
|
||||||
b.Stderr = ioutil.Discard
|
b.Stderr = ioutil.Discard
|
||||||
b.disableCommit = true
|
b.disableCommit = true
|
||||||
|
|
||||||
commands := []instructions.Command{}
|
var commands []instructions.Command
|
||||||
for _, n := range dockerfile.AST.Children {
|
for _, n := range dockerfile.AST.Children {
|
||||||
cmd, err := instructions.ParseCommand(n)
|
cmd, err := instructions.ParseCommand(n)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -2,7 +2,6 @@ package instructions // import "github.com/docker/docker/builder/dockerfile/inst
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
|
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/docker/docker/api/types/container"
|
"github.com/docker/docker/api/types/container"
|
||||||
|
|
|
@ -10,7 +10,7 @@ type testCase struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func initTestCases() []testCase {
|
func initTestCases() []testCase {
|
||||||
testCases := []testCase{}
|
var testCases []testCase
|
||||||
|
|
||||||
testCases = append(testCases, testCase{
|
testCases = append(testCases, testCase{
|
||||||
name: "empty args",
|
name: "empty args",
|
||||||
|
|
|
@ -262,8 +262,7 @@ func Parse(rwc io.Reader) (*Result, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if hasEmptyContinuationLine {
|
if hasEmptyContinuationLine {
|
||||||
warning := "[WARNING]: Empty continuation line found in:\n " + line
|
warnings = append(warnings, "[WARNING]: Empty continuation line found in:\n "+line)
|
||||||
warnings = append(warnings, warning)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
child, err := newNodeFromLine(line, d)
|
child, err := newNodeFromLine(line, d)
|
||||||
|
|
|
@ -71,8 +71,8 @@ func TestShellParser4Words(t *testing.T) {
|
||||||
}
|
}
|
||||||
defer file.Close()
|
defer file.Close()
|
||||||
|
|
||||||
|
var envs []string
|
||||||
shlex := NewLex('\\')
|
shlex := NewLex('\\')
|
||||||
envs := []string{}
|
|
||||||
scanner := bufio.NewScanner(file)
|
scanner := bufio.NewScanner(file)
|
||||||
lineNum := 0
|
lineNum := 0
|
||||||
for scanner.Scan() {
|
for scanner.Scan() {
|
||||||
|
|
|
@ -6,7 +6,7 @@ import (
|
||||||
|
|
||||||
"github.com/docker/docker/pkg/containerfs"
|
"github.com/docker/docker/pkg/containerfs"
|
||||||
iradix "github.com/hashicorp/go-immutable-radix"
|
iradix "github.com/hashicorp/go-immutable-radix"
|
||||||
digest "github.com/opencontainers/go-digest"
|
"github.com/opencontainers/go-digest"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"github.com/tonistiigi/fsutil"
|
"github.com/tonistiigi/fsutil"
|
||||||
)
|
)
|
||||||
|
|
|
@ -51,7 +51,7 @@ func hasManagementSubCommands(cmd *cobra.Command) bool {
|
||||||
}
|
}
|
||||||
|
|
||||||
func operationSubCommands(cmd *cobra.Command) []*cobra.Command {
|
func operationSubCommands(cmd *cobra.Command) []*cobra.Command {
|
||||||
cmds := []*cobra.Command{}
|
var cmds []*cobra.Command
|
||||||
for _, sub := range cmd.Commands() {
|
for _, sub := range cmd.Commands() {
|
||||||
if sub.IsAvailableCommand() && !sub.HasSubCommands() {
|
if sub.IsAvailableCommand() && !sub.HasSubCommands() {
|
||||||
cmds = append(cmds, sub)
|
cmds = append(cmds, sub)
|
||||||
|
@ -69,7 +69,7 @@ func wrappedFlagUsages(cmd *cobra.Command) string {
|
||||||
}
|
}
|
||||||
|
|
||||||
func managementSubCommands(cmd *cobra.Command) []*cobra.Command {
|
func managementSubCommands(cmd *cobra.Command) []*cobra.Command {
|
||||||
cmds := []*cobra.Command{}
|
var cmds []*cobra.Command
|
||||||
for _, sub := range cmd.Commands() {
|
for _, sub := range cmd.Commands() {
|
||||||
if sub.IsAvailableCommand() && sub.HasSubCommands() {
|
if sub.IsAvailableCommand() && sub.HasSubCommands() {
|
||||||
cmds = append(cmds, sub)
|
cmds = append(cmds, sub)
|
||||||
|
|
|
@ -2,6 +2,7 @@ package client // import "github.com/docker/docker/client"
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
|
@ -11,8 +12,6 @@ import (
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"context"
|
|
||||||
|
|
||||||
"github.com/docker/docker/api/types/container"
|
"github.com/docker/docker/api/types/container"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,6 @@ package client // import "github.com/docker/docker/client"
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"github.com/docker/docker/api/types/versions"
|
"github.com/docker/docker/api/types/versions"
|
||||||
|
|
|
@ -7,9 +7,8 @@ import (
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"net/http"
|
"net/http"
|
||||||
"reflect"
|
"reflect"
|
||||||
"testing"
|
|
||||||
|
|
||||||
"strings"
|
"strings"
|
||||||
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestImageSaveError(t *testing.T) {
|
func TestImageSaveError(t *testing.T) {
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
package client // import "github.com/docker/docker/client"
|
package client // import "github.com/docker/docker/client"
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"net/url"
|
|
||||||
|
|
||||||
"context"
|
"context"
|
||||||
|
"net/url"
|
||||||
|
|
||||||
"github.com/docker/docker/api/types"
|
"github.com/docker/docker/api/types"
|
||||||
)
|
)
|
||||||
|
|
|
@ -2,14 +2,13 @@ package client // import "github.com/docker/docker/client"
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"context"
|
|
||||||
|
|
||||||
"github.com/docker/docker/api/types"
|
"github.com/docker/docker/api/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -2,14 +2,13 @@ package client // import "github.com/docker/docker/client"
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"context"
|
|
||||||
|
|
||||||
"github.com/docker/docker/api/types"
|
"github.com/docker/docker/api/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -61,7 +61,7 @@ func TestSetHostHeader(t *testing.T) {
|
||||||
}
|
}
|
||||||
return &http.Response{
|
return &http.Response{
|
||||||
StatusCode: http.StatusOK,
|
StatusCode: http.StatusOK,
|
||||||
Body: ioutil.NopCloser(bytes.NewReader(([]byte("")))),
|
Body: ioutil.NopCloser(bytes.NewReader([]byte(""))),
|
||||||
}, nil
|
}, nil
|
||||||
}),
|
}),
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ import (
|
||||||
"github.com/docker/distribution/reference"
|
"github.com/docker/distribution/reference"
|
||||||
"github.com/docker/docker/api/types"
|
"github.com/docker/docker/api/types"
|
||||||
"github.com/docker/docker/api/types/swarm"
|
"github.com/docker/docker/api/types/swarm"
|
||||||
digest "github.com/opencontainers/go-digest"
|
"github.com/opencontainers/go-digest"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ package main
|
||||||
import (
|
import (
|
||||||
"github.com/docker/docker/daemon/config"
|
"github.com/docker/docker/daemon/config"
|
||||||
"github.com/docker/docker/opts"
|
"github.com/docker/docker/opts"
|
||||||
units "github.com/docker/go-units"
|
"github.com/docker/go-units"
|
||||||
"github.com/spf13/pflag"
|
"github.com/spf13/pflag"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ import (
|
||||||
"net"
|
"net"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
metrics "github.com/docker/go-metrics"
|
"github.com/docker/go-metrics"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -340,7 +340,7 @@ func (v *memdbView) transform(container *Container) *Snapshot {
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(container.Args) > 0 {
|
if len(container.Args) > 0 {
|
||||||
args := []string{}
|
var args []string
|
||||||
for _, arg := range container.Args {
|
for _, arg := range container.Args {
|
||||||
if strings.Contains(arg, " ") {
|
if strings.Contains(arg, " ") {
|
||||||
args = append(args, fmt.Sprintf("'%s'", arg))
|
args = append(args, fmt.Sprintf("'%s'", arg))
|
||||||
|
|
|
@ -5,7 +5,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
container "github.com/docker/docker/api/types/container"
|
"github.com/docker/docker/api/types/container"
|
||||||
mounttypes "github.com/docker/docker/api/types/mount"
|
mounttypes "github.com/docker/docker/api/types/mount"
|
||||||
types "github.com/docker/docker/api/types/swarm"
|
types "github.com/docker/docker/api/types/swarm"
|
||||||
swarmapi "github.com/docker/swarmkit/api"
|
swarmapi "github.com/docker/swarmkit/api"
|
||||||
|
|
|
@ -3,7 +3,7 @@ package container // import "github.com/docker/docker/daemon/cluster/executor/co
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
container "github.com/docker/docker/api/types/container"
|
"github.com/docker/docker/api/types/container"
|
||||||
swarmapi "github.com/docker/swarmkit/api"
|
swarmapi "github.com/docker/swarmkit/api"
|
||||||
"github.com/gotestyourself/gotestyourself/assert"
|
"github.com/gotestyourself/gotestyourself/assert"
|
||||||
)
|
)
|
||||||
|
|
|
@ -7,7 +7,7 @@ import (
|
||||||
|
|
||||||
containertypes "github.com/docker/docker/api/types/container"
|
containertypes "github.com/docker/docker/api/types/container"
|
||||||
"github.com/docker/docker/opts"
|
"github.com/docker/docker/opts"
|
||||||
units "github.com/docker/go-units"
|
"github.com/docker/go-units"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|
|
@ -6,7 +6,7 @@ import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/docker/docker/opts"
|
"github.com/docker/docker/opts"
|
||||||
units "github.com/docker/go-units"
|
"github.com/docker/go-units"
|
||||||
"github.com/gotestyourself/gotestyourself/assert"
|
"github.com/gotestyourself/gotestyourself/assert"
|
||||||
is "github.com/gotestyourself/gotestyourself/assert/cmp"
|
is "github.com/gotestyourself/gotestyourself/assert/cmp"
|
||||||
"github.com/gotestyourself/gotestyourself/fs"
|
"github.com/gotestyourself/gotestyourself/fs"
|
||||||
|
|
|
@ -43,7 +43,7 @@ import (
|
||||||
lntypes "github.com/docker/libnetwork/types"
|
lntypes "github.com/docker/libnetwork/types"
|
||||||
"github.com/opencontainers/runc/libcontainer/cgroups"
|
"github.com/opencontainers/runc/libcontainer/cgroups"
|
||||||
rsystem "github.com/opencontainers/runc/libcontainer/system"
|
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/opencontainers/selinux/go-selinux/label"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"github.com/sirupsen/logrus"
|
"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
|
// It's not kernel limit, we want this 4M limit to supply a reasonable functional container
|
||||||
linuxMinMemory = 4194304
|
linuxMinMemory = 4194304
|
||||||
// constants for remapped root settings
|
// constants for remapped root settings
|
||||||
defaultIDSpecifier string = "default"
|
defaultIDSpecifier = "default"
|
||||||
defaultRemappedID string = "dockremap"
|
defaultRemappedID = "dockremap"
|
||||||
|
|
||||||
// constant for cgroup drivers
|
// constant for cgroup drivers
|
||||||
cgroupFsDriver = "cgroupfs"
|
cgroupFsDriver = "cgroupfs"
|
||||||
|
|
|
@ -16,7 +16,7 @@ import (
|
||||||
"github.com/docker/docker/pkg/pools"
|
"github.com/docker/docker/pkg/pools"
|
||||||
"github.com/docker/docker/pkg/signal"
|
"github.com/docker/docker/pkg/signal"
|
||||||
"github.com/docker/docker/pkg/term"
|
"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/pkg/errors"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
)
|
)
|
||||||
|
|
|
@ -15,7 +15,7 @@ func loadIds(root string) ([]string, error) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
out := []string{}
|
var out []string
|
||||||
for _, d := range dirs {
|
for _, d := range dirs {
|
||||||
if !d.IsDir() {
|
if !d.IsDir() {
|
||||||
out = append(out, d.Name())
|
out = append(out, d.Name())
|
||||||
|
@ -36,7 +36,7 @@ func getParentIDs(root, id string) ([]string, error) {
|
||||||
}
|
}
|
||||||
defer f.Close()
|
defer f.Close()
|
||||||
|
|
||||||
out := []string{}
|
var out []string
|
||||||
s := bufio.NewScanner(f)
|
s := bufio.NewScanner(f)
|
||||||
|
|
||||||
for s.Scan() {
|
for s.Scan() {
|
||||||
|
|
|
@ -27,7 +27,7 @@ import (
|
||||||
"github.com/docker/docker/pkg/mount"
|
"github.com/docker/docker/pkg/mount"
|
||||||
"github.com/docker/docker/pkg/parsers"
|
"github.com/docker/docker/pkg/parsers"
|
||||||
"github.com/docker/docker/pkg/parsers/kernel"
|
"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/opencontainers/selinux/go-selinux/label"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
|
@ -50,8 +50,8 @@ var (
|
||||||
lvmSetupConfigForce bool
|
lvmSetupConfigForce bool
|
||||||
)
|
)
|
||||||
|
|
||||||
const deviceSetMetaFile string = "deviceset-metadata"
|
const deviceSetMetaFile = "deviceset-metadata"
|
||||||
const transactionMetaFile string = "transaction-metadata"
|
const transactionMetaFile = "transaction-metadata"
|
||||||
|
|
||||||
type transaction struct {
|
type transaction struct {
|
||||||
OpenTransactionID uint64 `json:"open_transaction_id"`
|
OpenTransactionID uint64 `json:"open_transaction_id"`
|
||||||
|
|
|
@ -15,7 +15,7 @@ import (
|
||||||
"github.com/docker/docker/pkg/idtools"
|
"github.com/docker/docker/pkg/idtools"
|
||||||
"github.com/docker/docker/pkg/locker"
|
"github.com/docker/docker/pkg/locker"
|
||||||
"github.com/docker/docker/pkg/mount"
|
"github.com/docker/docker/pkg/mount"
|
||||||
units "github.com/docker/go-units"
|
"github.com/docker/go-units"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
"golang.org/x/sys/unix"
|
"golang.org/x/sys/unix"
|
||||||
|
|
|
@ -15,7 +15,7 @@ import (
|
||||||
"github.com/docker/docker/daemon/graphdriver"
|
"github.com/docker/docker/daemon/graphdriver"
|
||||||
"github.com/docker/docker/daemon/graphdriver/quota"
|
"github.com/docker/docker/daemon/graphdriver/quota"
|
||||||
"github.com/docker/docker/pkg/stringid"
|
"github.com/docker/docker/pkg/stringid"
|
||||||
units "github.com/docker/go-units"
|
"github.com/docker/go-units"
|
||||||
"github.com/gotestyourself/gotestyourself/assert"
|
"github.com/gotestyourself/gotestyourself/assert"
|
||||||
is "github.com/gotestyourself/gotestyourself/assert/cmp"
|
is "github.com/gotestyourself/gotestyourself/assert/cmp"
|
||||||
"golang.org/x/sys/unix"
|
"golang.org/x/sys/unix"
|
||||||
|
|
|
@ -148,7 +148,7 @@ func changeManyFiles(drv graphdriver.Driver, layer string, count int, seed int64
|
||||||
}
|
}
|
||||||
defer drv.Put(layer)
|
defer drv.Put(layer)
|
||||||
|
|
||||||
changes := []archive.Change{}
|
var changes []archive.Change
|
||||||
for i := 0; i < count; i += 100 {
|
for i := 0; i < count; i += 100 {
|
||||||
archiveRoot := fmt.Sprintf("/directory-%d", i)
|
archiveRoot := fmt.Sprintf("/directory-%d", i)
|
||||||
if err := root.MkdirAll(root.Join(root.Path(), archiveRoot), 0755); err != nil {
|
if err := root.MkdirAll(root.Join(root.Path(), archiveRoot), 0755); err != nil {
|
||||||
|
|
|
@ -10,7 +10,7 @@ import (
|
||||||
"github.com/docker/docker/pkg/containerfs"
|
"github.com/docker/docker/pkg/containerfs"
|
||||||
"github.com/docker/docker/pkg/idtools"
|
"github.com/docker/docker/pkg/idtools"
|
||||||
"github.com/docker/docker/pkg/system"
|
"github.com/docker/docker/pkg/system"
|
||||||
units "github.com/docker/go-units"
|
"github.com/docker/go-units"
|
||||||
"github.com/opencontainers/selinux/go-selinux/label"
|
"github.com/opencontainers/selinux/go-selinux/label"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@ import (
|
||||||
"github.com/docker/docker/pkg/idtools"
|
"github.com/docker/docker/pkg/idtools"
|
||||||
"github.com/docker/docker/pkg/mount"
|
"github.com/docker/docker/pkg/mount"
|
||||||
"github.com/docker/docker/pkg/parsers"
|
"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/opencontainers/selinux/go-selinux/label"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
"golang.org/x/sys/unix"
|
"golang.org/x/sys/unix"
|
||||||
|
|
|
@ -18,7 +18,7 @@ import (
|
||||||
type conflictType int
|
type conflictType int
|
||||||
|
|
||||||
const (
|
const (
|
||||||
conflictDependentChild conflictType = (1 << iota)
|
conflictDependentChild conflictType = 1 << iota
|
||||||
conflictRunningContainer
|
conflictRunningContainer
|
||||||
conflictActiveReference
|
conflictActiveReference
|
||||||
conflictStoppedContainer
|
conflictStoppedContainer
|
||||||
|
@ -126,7 +126,7 @@ func (i *ImageService) ImageDelete(imageRef string, force, prune bool) ([]types.
|
||||||
}
|
}
|
||||||
if !foundRepoTagRef {
|
if !foundRepoTagRef {
|
||||||
// Remove canonical references from same repository
|
// Remove canonical references from same repository
|
||||||
remainingRefs := []reference.Named{}
|
var remainingRefs []reference.Named
|
||||||
for _, repoRef := range repoRefs {
|
for _, repoRef := range repoRefs {
|
||||||
if _, repoRefIsCanonical := repoRef.(reference.Canonical); repoRefIsCanonical && parsedRef.Name() == repoRef.Name() {
|
if _, repoRefIsCanonical := repoRef.(reference.Canonical); repoRefIsCanonical && parsedRef.Name() == repoRef.Name() {
|
||||||
if _, err := i.removeImageRef(repoRef); err != nil {
|
if _, err := i.removeImageRef(repoRef); err != nil {
|
||||||
|
|
|
@ -13,7 +13,7 @@ import (
|
||||||
"github.com/docker/docker/errdefs"
|
"github.com/docker/docker/errdefs"
|
||||||
"github.com/docker/docker/image"
|
"github.com/docker/docker/image"
|
||||||
"github.com/docker/docker/layer"
|
"github.com/docker/docker/layer"
|
||||||
digest "github.com/opencontainers/go-digest"
|
"github.com/opencontainers/go-digest"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ package images // import "github.com/docker/docker/daemon/images"
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
metrics "github.com/docker/go-metrics"
|
"github.com/docker/go-metrics"
|
||||||
)
|
)
|
||||||
|
|
||||||
type invalidFilter struct {
|
type invalidFilter struct {
|
||||||
|
|
|
@ -37,7 +37,7 @@ func (a *pluginAdapter) Log(msg *Message) error {
|
||||||
|
|
||||||
a.buf.Line = msg.Line
|
a.buf.Line = msg.Line
|
||||||
a.buf.TimeNano = msg.Timestamp.UnixNano()
|
a.buf.TimeNano = msg.Timestamp.UnixNano()
|
||||||
a.buf.Partial = (msg.PLogMetaData != nil)
|
a.buf.Partial = msg.PLogMetaData != nil
|
||||||
a.buf.Source = msg.Source
|
a.buf.Source = msg.Source
|
||||||
|
|
||||||
err := a.enc.Encode(&a.buf)
|
err := a.enc.Encode(&a.buf)
|
||||||
|
|
|
@ -1139,8 +1139,8 @@ func TestCollectBatchWithDuplicateTimestamps(t *testing.T) {
|
||||||
close(d)
|
close(d)
|
||||||
go stream.collectBatch(d)
|
go stream.collectBatch(d)
|
||||||
|
|
||||||
|
var expectedEvents []*cloudwatchlogs.InputLogEvent
|
||||||
times := maximumLogEventsPerPut
|
times := maximumLogEventsPerPut
|
||||||
expectedEvents := []*cloudwatchlogs.InputLogEvent{}
|
|
||||||
timestamp := time.Now()
|
timestamp := time.Now()
|
||||||
for i := 0; i < times; i++ {
|
for i := 0; i < times; i++ {
|
||||||
line := fmt.Sprintf("%d", i)
|
line := fmt.Sprintf("%d", i)
|
||||||
|
|
|
@ -7,7 +7,7 @@ import (
|
||||||
|
|
||||||
containertypes "github.com/docker/docker/api/types/container"
|
containertypes "github.com/docker/docker/api/types/container"
|
||||||
"github.com/docker/docker/pkg/plugingetter"
|
"github.com/docker/docker/pkg/plugingetter"
|
||||||
units "github.com/docker/go-units"
|
"github.com/docker/go-units"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -1,13 +1,12 @@
|
||||||
package gcplogs // import "github.com/docker/docker/daemon/logger/gcplogs"
|
package gcplogs // import "github.com/docker/docker/daemon/logger/gcplogs"
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"sync"
|
"sync"
|
||||||
"sync/atomic"
|
"sync/atomic"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"context"
|
|
||||||
|
|
||||||
"github.com/docker/docker/daemon/logger"
|
"github.com/docker/docker/daemon/logger"
|
||||||
|
|
||||||
"cloud.google.com/go/compute/metadata"
|
"cloud.google.com/go/compute/metadata"
|
||||||
|
|
|
@ -13,7 +13,7 @@ import (
|
||||||
"github.com/docker/docker/daemon/logger"
|
"github.com/docker/docker/daemon/logger"
|
||||||
"github.com/docker/docker/daemon/logger/jsonfilelog/jsonlog"
|
"github.com/docker/docker/daemon/logger/jsonfilelog/jsonlog"
|
||||||
"github.com/docker/docker/daemon/logger/loggerutils"
|
"github.com/docker/docker/daemon/logger/loggerutils"
|
||||||
units "github.com/docker/go-units"
|
"github.com/docker/go-units"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
)
|
)
|
||||||
|
|
|
@ -205,7 +205,7 @@ func TestMultiReadSeekerCurAfterSet(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestMultiReadSeekerSmallReads(t *testing.T) {
|
func TestMultiReadSeekerSmallReads(t *testing.T) {
|
||||||
readers := []io.ReadSeeker{}
|
var readers []io.ReadSeeker
|
||||||
for i := 0; i < 10; i++ {
|
for i := 0; i < 10; i++ {
|
||||||
integer := make([]byte, 4)
|
integer := make([]byte, 4)
|
||||||
binary.BigEndian.PutUint32(integer, uint32(i))
|
binary.BigEndian.PutUint32(integer, uint32(i))
|
||||||
|
|
|
@ -4,7 +4,7 @@ import (
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/docker/docker/pkg/plugingetter"
|
"github.com/docker/docker/pkg/plugingetter"
|
||||||
metrics "github.com/docker/go-metrics"
|
"github.com/docker/go-metrics"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"github.com/prometheus/client_golang/prometheus"
|
"github.com/prometheus/client_golang/prometheus"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
|
|
|
@ -10,8 +10,8 @@ import (
|
||||||
"github.com/docker/docker/pkg/plugingetter"
|
"github.com/docker/docker/pkg/plugingetter"
|
||||||
"github.com/docker/docker/pkg/plugins"
|
"github.com/docker/docker/pkg/plugins"
|
||||||
"github.com/docker/docker/plugin"
|
"github.com/docker/docker/plugin"
|
||||||
metrics "github.com/docker/go-metrics"
|
"github.com/docker/go-metrics"
|
||||||
specs "github.com/opencontainers/runtime-spec/specs-go"
|
"github.com/opencontainers/runtime-spec/specs-go"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
"golang.org/x/sys/unix"
|
"golang.org/x/sys/unix"
|
||||||
|
|
|
@ -23,7 +23,7 @@ import (
|
||||||
"github.com/opencontainers/runc/libcontainer/cgroups"
|
"github.com/opencontainers/runc/libcontainer/cgroups"
|
||||||
"github.com/opencontainers/runc/libcontainer/devices"
|
"github.com/opencontainers/runc/libcontainer/devices"
|
||||||
"github.com/opencontainers/runc/libcontainer/user"
|
"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/pkg/errors"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
"golang.org/x/sys/unix"
|
"golang.org/x/sys/unix"
|
||||||
|
|
|
@ -89,7 +89,7 @@ func TestDaemonReloadAllowNondistributableArtifacts(t *testing.T) {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
actual := []string{}
|
var actual []string
|
||||||
serviceConfig := daemon.RegistryService.ServiceConfig()
|
serviceConfig := daemon.RegistryService.ServiceConfig()
|
||||||
for _, value := range serviceConfig.AllowNondistributableArtifactsCIDRs {
|
for _, value := range serviceConfig.AllowNondistributableArtifactsCIDRs {
|
||||||
actual = append(actual, value.String())
|
actual = append(actual, value.String())
|
||||||
|
|
|
@ -5,7 +5,7 @@ import (
|
||||||
|
|
||||||
"github.com/docker/docker/api/types/container"
|
"github.com/docker/docker/api/types/container"
|
||||||
"github.com/docker/docker/libcontainerd"
|
"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 {
|
func toContainerdResources(resources container.Resources) *libcontainerd.Resources {
|
||||||
|
|
|
@ -48,7 +48,7 @@ func TestContinueOnError_NonMirrorEndpoint(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestContinueOnError_MirrorEndpoint(t *testing.T) {
|
func TestContinueOnError_MirrorEndpoint(t *testing.T) {
|
||||||
errs := []error{}
|
var errs []error
|
||||||
errs = append(errs, alwaysContinue...)
|
errs = append(errs, alwaysContinue...)
|
||||||
errs = append(errs, continueFromMirrorEndpoint...)
|
errs = append(errs, continueFromMirrorEndpoint...)
|
||||||
for _, err := range errs {
|
for _, err := range errs {
|
||||||
|
|
|
@ -30,7 +30,7 @@ import (
|
||||||
"github.com/docker/docker/pkg/system"
|
"github.com/docker/docker/pkg/system"
|
||||||
refstore "github.com/docker/docker/reference"
|
refstore "github.com/docker/docker/reference"
|
||||||
"github.com/docker/docker/registry"
|
"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"
|
specs "github.com/opencontainers/image-spec/specs-go/v1"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
|
|
|
@ -24,7 +24,7 @@ import (
|
||||||
"github.com/docker/docker/pkg/progress"
|
"github.com/docker/docker/pkg/progress"
|
||||||
"github.com/docker/docker/pkg/stringid"
|
"github.com/docker/docker/pkg/stringid"
|
||||||
"github.com/docker/docker/registry"
|
"github.com/docker/docker/registry"
|
||||||
digest "github.com/opencontainers/go-digest"
|
"github.com/opencontainers/go-digest"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -6,12 +6,12 @@ package dockerversion // import "github.com/docker/docker/dockerversion"
|
||||||
// Default build-time variable for library-import.
|
// Default build-time variable for library-import.
|
||||||
// This file is overridden on build with build-time informations.
|
// This file is overridden on build with build-time informations.
|
||||||
const (
|
const (
|
||||||
GitCommit string = "library-import"
|
GitCommit = "library-import"
|
||||||
Version string = "library-import"
|
Version = "library-import"
|
||||||
BuildTime string = "library-import"
|
BuildTime = "library-import"
|
||||||
IAmStatic string = "library-import"
|
IAmStatic = "library-import"
|
||||||
ContainerdCommitID string = "library-import"
|
ContainerdCommitID = "library-import"
|
||||||
RuncCommitID string = "library-import"
|
RuncCommitID = "library-import"
|
||||||
InitCommitID string = "library-import"
|
InitCommitID = "library-import"
|
||||||
PlatformName string = ""
|
PlatformName = ""
|
||||||
)
|
)
|
||||||
|
|
|
@ -8,7 +8,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
func generateInput(inputLen int) []string {
|
func generateInput(inputLen int) []string {
|
||||||
input := []string{}
|
var input []string
|
||||||
for i := 0; i < inputLen; i++ {
|
for i := 0; i < inputLen; i++ {
|
||||||
input = append(input, fmt.Sprintf("s%d", i))
|
input = append(input, fmt.Sprintf("s%d", i))
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@ func testChunkStrings(t *testing.T, inputLen, numChunks int) {
|
||||||
input := generateInput(inputLen)
|
input := generateInput(inputLen)
|
||||||
result := chunkStrings(input, numChunks)
|
result := chunkStrings(input, numChunks)
|
||||||
t.Logf("result has %d chunks", len(result))
|
t.Logf("result has %d chunks", len(result))
|
||||||
inputReconstructedFromResult := []string{}
|
var inputReconstructedFromResult []string
|
||||||
for i, chunk := range result {
|
for i, chunk := range result {
|
||||||
t.Logf("chunk %d has %d elements", i, len(chunk))
|
t.Logf("chunk %d has %d elements", i, len(chunk))
|
||||||
inputReconstructedFromResult = append(inputReconstructedFromResult, chunk...)
|
inputReconstructedFromResult = append(inputReconstructedFromResult, chunk...)
|
||||||
|
|
|
@ -23,7 +23,7 @@ import (
|
||||||
"github.com/docker/docker/pkg/stringid"
|
"github.com/docker/docker/pkg/stringid"
|
||||||
"github.com/docker/docker/pkg/symlink"
|
"github.com/docker/docker/pkg/symlink"
|
||||||
"github.com/docker/docker/pkg/system"
|
"github.com/docker/docker/pkg/system"
|
||||||
digest "github.com/opencontainers/go-digest"
|
"github.com/opencontainers/go-digest"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -543,7 +543,7 @@ type buildLine struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func getImageIDsFromBuild(c *check.C, output []byte) []string {
|
func getImageIDsFromBuild(c *check.C, output []byte) []string {
|
||||||
ids := []string{}
|
var ids []string
|
||||||
for _, line := range bytes.Split(output, []byte("\n")) {
|
for _, line := range bytes.Split(output, []byte("\n")) {
|
||||||
if len(line) == 0 {
|
if len(line) == 0 {
|
||||||
continue
|
continue
|
||||||
|
|
|
@ -289,7 +289,7 @@ func isNetworkAvailable(c *check.C, name string) bool {
|
||||||
defer resp.Body.Close()
|
defer resp.Body.Close()
|
||||||
c.Assert(resp.StatusCode, checker.Equals, http.StatusOK)
|
c.Assert(resp.StatusCode, checker.Equals, http.StatusOK)
|
||||||
|
|
||||||
nJSON := []types.NetworkResource{}
|
var nJSON []types.NetworkResource
|
||||||
err = json.NewDecoder(body).Decode(&nJSON)
|
err = json.NewDecoder(body).Decode(&nJSON)
|
||||||
c.Assert(err, checker.IsNil)
|
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(resp.StatusCode, checker.Equals, http.StatusOK)
|
||||||
c.Assert(err, checker.IsNil)
|
c.Assert(err, checker.IsNil)
|
||||||
|
|
||||||
nJSON := []types.NetworkResource{}
|
var nJSON []types.NetworkResource
|
||||||
err = json.NewDecoder(body).Decode(&nJSON)
|
err = json.NewDecoder(body).Decode(&nJSON)
|
||||||
c.Assert(err, checker.IsNil)
|
c.Assert(err, checker.IsNil)
|
||||||
var res string
|
var res string
|
||||||
|
|
|
@ -27,7 +27,7 @@ import (
|
||||||
"github.com/docker/docker/pkg/archive"
|
"github.com/docker/docker/pkg/archive"
|
||||||
"github.com/go-check/check"
|
"github.com/go-check/check"
|
||||||
"github.com/gotestyourself/gotestyourself/icmd"
|
"github.com/gotestyourself/gotestyourself/icmd"
|
||||||
digest "github.com/opencontainers/go-digest"
|
"github.com/opencontainers/go-digest"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (s *DockerSuite) TestBuildJSONEmptyRun(c *check.C) {
|
func (s *DockerSuite) TestBuildJSONEmptyRun(c *check.C) {
|
||||||
|
@ -195,7 +195,7 @@ func (s *DockerSuite) TestBuildEnvironmentReplacementEnv(c *check.C) {
|
||||||
RUN [ "$foo5" = 'abc\def' ]
|
RUN [ "$foo5" = 'abc\def' ]
|
||||||
`))
|
`))
|
||||||
|
|
||||||
envResult := []string{}
|
var envResult []string
|
||||||
inspectFieldAndUnmarshall(c, name, "Config.Env", &envResult)
|
inspectFieldAndUnmarshall(c, name, "Config.Env", &envResult)
|
||||||
found := false
|
found := false
|
||||||
envCount := 0
|
envCount := 0
|
||||||
|
@ -4979,7 +4979,7 @@ func (s *DockerSuite) TestBuildLabelMultiple(c *check.C) {
|
||||||
"foo": "bar",
|
"foo": "bar",
|
||||||
"123": "456",
|
"123": "456",
|
||||||
}
|
}
|
||||||
labelArgs := []string{}
|
var labelArgs []string
|
||||||
for k, v := range testLabels {
|
for k, v := range testLabels {
|
||||||
labelArgs = append(labelArgs, "--label", k+"="+v)
|
labelArgs = append(labelArgs, "--label", k+"="+v)
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,7 @@ import (
|
||||||
"github.com/docker/docker/integration-cli/cli"
|
"github.com/docker/docker/integration-cli/cli"
|
||||||
"github.com/docker/docker/integration-cli/cli/build"
|
"github.com/docker/docker/integration-cli/cli/build"
|
||||||
"github.com/docker/docker/internal/test/fakecontext"
|
"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/go-check/check"
|
||||||
"github.com/gotestyourself/gotestyourself/icmd"
|
"github.com/gotestyourself/gotestyourself/icmd"
|
||||||
)
|
)
|
||||||
|
|
|
@ -26,13 +26,13 @@ func (s *DockerSuite) TestCreateArgs(c *check.C) {
|
||||||
|
|
||||||
out, _ = dockerCmd(c, "inspect", cleanedContainerID)
|
out, _ = dockerCmd(c, "inspect", cleanedContainerID)
|
||||||
|
|
||||||
containers := []struct {
|
var containers []struct {
|
||||||
ID string
|
ID string
|
||||||
Created time.Time
|
Created time.Time
|
||||||
Path string
|
Path string
|
||||||
Args []string
|
Args []string
|
||||||
Image string
|
Image string
|
||||||
}{}
|
}
|
||||||
|
|
||||||
err := json.Unmarshal([]byte(out), &containers)
|
err := json.Unmarshal([]byte(out), &containers)
|
||||||
c.Assert(err, check.IsNil, check.Commentf("Error inspecting the container: %s", err))
|
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)
|
out, _ = dockerCmd(c, "inspect", cleanedContainerID)
|
||||||
|
|
||||||
containers := []struct {
|
var containers []struct {
|
||||||
HostConfig *struct {
|
HostConfig *struct {
|
||||||
PublishAllPorts bool
|
PublishAllPorts bool
|
||||||
}
|
}
|
||||||
}{}
|
}
|
||||||
|
|
||||||
err := json.Unmarshal([]byte(out), &containers)
|
err := json.Unmarshal([]byte(out), &containers)
|
||||||
c.Assert(err, check.IsNil, check.Commentf("Error inspecting the container: %s", err))
|
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)
|
out, _ = dockerCmd(c, "inspect", cleanedContainerID)
|
||||||
|
|
||||||
containers := []struct {
|
var containers []struct {
|
||||||
HostConfig *struct {
|
HostConfig *struct {
|
||||||
PortBindings map[nat.Port][]nat.PortBinding
|
PortBindings map[nat.Port][]nat.PortBinding
|
||||||
}
|
}
|
||||||
}{}
|
}
|
||||||
err := json.Unmarshal([]byte(out), &containers)
|
err := json.Unmarshal([]byte(out), &containers)
|
||||||
c.Assert(err, check.IsNil, check.Commentf("Error inspecting the container: %s", err))
|
c.Assert(err, check.IsNil, check.Commentf("Error inspecting the container: %s", err))
|
||||||
c.Assert(containers, checker.HasLen, 1)
|
c.Assert(containers, checker.HasLen, 1)
|
||||||
|
@ -138,11 +138,11 @@ func (s *DockerSuite) TestCreateWithLargePortRange(c *check.C) {
|
||||||
|
|
||||||
out, _ = dockerCmd(c, "inspect", cleanedContainerID)
|
out, _ = dockerCmd(c, "inspect", cleanedContainerID)
|
||||||
|
|
||||||
containers := []struct {
|
var containers []struct {
|
||||||
HostConfig *struct {
|
HostConfig *struct {
|
||||||
PortBindings map[nat.Port][]nat.PortBinding
|
PortBindings map[nat.Port][]nat.PortBinding
|
||||||
}
|
}
|
||||||
}{}
|
}
|
||||||
|
|
||||||
err := json.Unmarshal([]byte(out), &containers)
|
err := json.Unmarshal([]byte(out), &containers)
|
||||||
c.Assert(err, check.IsNil, check.Commentf("Error inspecting the container: %s", err))
|
c.Assert(err, check.IsNil, check.Commentf("Error inspecting the container: %s", err))
|
||||||
|
|
|
@ -6,6 +6,8 @@ import (
|
||||||
"bufio"
|
"bufio"
|
||||||
"bytes"
|
"bytes"
|
||||||
"context"
|
"context"
|
||||||
|
"crypto/tls"
|
||||||
|
"crypto/x509"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
|
@ -21,9 +23,6 @@ import (
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"crypto/tls"
|
|
||||||
"crypto/x509"
|
|
||||||
|
|
||||||
"github.com/cloudflare/cfssl/helpers"
|
"github.com/cloudflare/cfssl/helpers"
|
||||||
"github.com/docker/docker/api"
|
"github.com/docker/docker/api"
|
||||||
"github.com/docker/docker/api/types"
|
"github.com/docker/docker/api/types"
|
||||||
|
@ -36,7 +35,7 @@ import (
|
||||||
testdaemon "github.com/docker/docker/internal/test/daemon"
|
testdaemon "github.com/docker/docker/internal/test/daemon"
|
||||||
"github.com/docker/docker/opts"
|
"github.com/docker/docker/opts"
|
||||||
"github.com/docker/docker/pkg/mount"
|
"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/libnetwork/iptables"
|
||||||
"github.com/docker/libtrust"
|
"github.com/docker/libtrust"
|
||||||
"github.com/go-check/check"
|
"github.com/go-check/check"
|
||||||
|
@ -1828,8 +1827,8 @@ func (s *DockerDaemonSuite) TestDaemonNoSpaceLeftOnDeviceError(c *check.C) {
|
||||||
func (s *DockerDaemonSuite) TestDaemonRestartContainerLinksRestart(c *check.C) {
|
func (s *DockerDaemonSuite) TestDaemonRestartContainerLinksRestart(c *check.C) {
|
||||||
s.d.StartWithBusybox(c)
|
s.d.StartWithBusybox(c)
|
||||||
|
|
||||||
parent1Args := []string{}
|
var parent1Args []string
|
||||||
parent2Args := []string{}
|
var parent2Args []string
|
||||||
wg := sync.WaitGroup{}
|
wg := sync.WaitGroup{}
|
||||||
maxChildren := 10
|
maxChildren := 10
|
||||||
chErr := make(chan error, maxChildren)
|
chErr := make(chan error, maxChildren)
|
||||||
|
|
|
@ -262,7 +262,7 @@ func (s *DockerSuite) TestExecCgroup(c *check.C) {
|
||||||
|
|
||||||
var wg sync.WaitGroup
|
var wg sync.WaitGroup
|
||||||
var mu sync.Mutex
|
var mu sync.Mutex
|
||||||
execCgroups := []sort.StringSlice{}
|
var execCgroups []sort.StringSlice
|
||||||
errChan := make(chan error)
|
errChan := make(chan error)
|
||||||
// exec a few times concurrently to get consistent failure
|
// exec a few times concurrently to get consistent failure
|
||||||
for i := 0; i < 5; i++ {
|
for i := 0; i < 5; i++ {
|
||||||
|
|
|
@ -273,7 +273,7 @@ func assertNwList(c *check.C, out string, expectNws []string) {
|
||||||
|
|
||||||
func getNwResource(c *check.C, name string) *types.NetworkResource {
|
func getNwResource(c *check.C, name string) *types.NetworkResource {
|
||||||
out, _ := dockerCmd(c, "network", "inspect", name)
|
out, _ := dockerCmd(c, "network", "inspect", name)
|
||||||
nr := []types.NetworkResource{}
|
var nr []types.NetworkResource
|
||||||
err := json.Unmarshal([]byte(out), &nr)
|
err := json.Unmarshal([]byte(out), &nr)
|
||||||
c.Assert(err, check.IsNil)
|
c.Assert(err, check.IsNil)
|
||||||
return &nr[0]
|
return &nr[0]
|
||||||
|
@ -426,7 +426,7 @@ func (s *DockerSuite) TestDockerNetworkDeleteMultiple(c *check.C) {
|
||||||
|
|
||||||
func (s *DockerSuite) TestDockerNetworkInspect(c *check.C) {
|
func (s *DockerSuite) TestDockerNetworkInspect(c *check.C) {
|
||||||
out, _ := dockerCmd(c, "network", "inspect", "host")
|
out, _ := dockerCmd(c, "network", "inspect", "host")
|
||||||
networkResources := []types.NetworkResource{}
|
var networkResources []types.NetworkResource
|
||||||
err := json.Unmarshal([]byte(out), &networkResources)
|
err := json.Unmarshal([]byte(out), &networkResources)
|
||||||
c.Assert(err, check.IsNil)
|
c.Assert(err, check.IsNil)
|
||||||
c.Assert(networkResources, checker.HasLen, 1)
|
c.Assert(networkResources, checker.HasLen, 1)
|
||||||
|
@ -450,7 +450,7 @@ func (s *DockerSuite) TestDockerInspectMultipleNetwork(c *check.C) {
|
||||||
result := dockerCmdWithResult("network", "inspect", "host", "none")
|
result := dockerCmdWithResult("network", "inspect", "host", "none")
|
||||||
result.Assert(c, icmd.Success)
|
result.Assert(c, icmd.Success)
|
||||||
|
|
||||||
networkResources := []types.NetworkResource{}
|
var networkResources []types.NetworkResource
|
||||||
err := json.Unmarshal([]byte(result.Stdout()), &networkResources)
|
err := json.Unmarshal([]byte(result.Stdout()), &networkResources)
|
||||||
c.Assert(err, check.IsNil)
|
c.Assert(err, check.IsNil)
|
||||||
c.Assert(networkResources, checker.HasLen, 2)
|
c.Assert(networkResources, checker.HasLen, 2)
|
||||||
|
@ -466,7 +466,7 @@ func (s *DockerSuite) TestDockerInspectMultipleNetworksIncludingNonexistent(c *c
|
||||||
Out: "host",
|
Out: "host",
|
||||||
})
|
})
|
||||||
|
|
||||||
networkResources := []types.NetworkResource{}
|
var networkResources []types.NetworkResource
|
||||||
err := json.Unmarshal([]byte(result.Stdout()), &networkResources)
|
err := json.Unmarshal([]byte(result.Stdout()), &networkResources)
|
||||||
c.Assert(err, check.IsNil)
|
c.Assert(err, check.IsNil)
|
||||||
c.Assert(networkResources, checker.HasLen, 1)
|
c.Assert(networkResources, checker.HasLen, 1)
|
||||||
|
@ -512,7 +512,7 @@ func (s *DockerSuite) TestDockerInspectNetworkWithContainerName(c *check.C) {
|
||||||
}()
|
}()
|
||||||
|
|
||||||
out, _ = dockerCmd(c, "network", "inspect", "brNetForInspect")
|
out, _ = dockerCmd(c, "network", "inspect", "brNetForInspect")
|
||||||
networkResources := []types.NetworkResource{}
|
var networkResources []types.NetworkResource
|
||||||
err := json.Unmarshal([]byte(out), &networkResources)
|
err := json.Unmarshal([]byte(out), &networkResources)
|
||||||
c.Assert(err, check.IsNil)
|
c.Assert(err, check.IsNil)
|
||||||
c.Assert(networkResources, checker.HasLen, 1)
|
c.Assert(networkResources, checker.HasLen, 1)
|
||||||
|
@ -526,7 +526,7 @@ func (s *DockerSuite) TestDockerInspectNetworkWithContainerName(c *check.C) {
|
||||||
|
|
||||||
// check whether network inspect works properly
|
// check whether network inspect works properly
|
||||||
out, _ = dockerCmd(c, "network", "inspect", "brNetForInspect")
|
out, _ = dockerCmd(c, "network", "inspect", "brNetForInspect")
|
||||||
newNetRes := []types.NetworkResource{}
|
var newNetRes []types.NetworkResource
|
||||||
err = json.Unmarshal([]byte(out), &newNetRes)
|
err = json.Unmarshal([]byte(out), &newNetRes)
|
||||||
c.Assert(err, check.IsNil)
|
c.Assert(err, check.IsNil)
|
||||||
c.Assert(newNetRes, checker.HasLen, 1)
|
c.Assert(newNetRes, checker.HasLen, 1)
|
||||||
|
|
|
@ -172,7 +172,7 @@ func (s *DockerSuite) TestPsListContainersSize(c *check.C) {
|
||||||
idIndex := strings.Index(lines[0], "CONTAINER ID")
|
idIndex := strings.Index(lines[0], "CONTAINER ID")
|
||||||
foundID := lines[1][idIndex : idIndex+12]
|
foundID := lines[1][idIndex : idIndex+12]
|
||||||
c.Assert(foundID, checker.Equals, id[:12], check.Commentf("Expected id %s, got %s", id[:12], foundID))
|
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:]
|
foundSize := lines[1][sizeIndex:]
|
||||||
c.Assert(foundSize, checker.Contains, expectedSize, check.Commentf("Expected size %q, got %q", expectedSize, foundSize))
|
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) {
|
func checkPsAncestorFilterOutput(c *check.C, out string, filterName string, expectedIDs []string) {
|
||||||
actualIDs := []string{}
|
var actualIDs []string
|
||||||
if out != "" {
|
if out != "" {
|
||||||
actualIDs = strings.Split(out[:len(out)-1], "\n")
|
actualIDs = strings.Split(out[:len(out)-1], "\n")
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,7 @@ import (
|
||||||
func testPullImageWithAliases(c *check.C) {
|
func testPullImageWithAliases(c *check.C) {
|
||||||
repoName := fmt.Sprintf("%v/dockercli/busybox", privateRegistryURL)
|
repoName := fmt.Sprintf("%v/dockercli/busybox", privateRegistryURL)
|
||||||
|
|
||||||
repos := []string{}
|
var repos []string
|
||||||
for _, tag := range []string{"recent", "fresh"} {
|
for _, tag := range []string{"recent", "fresh"} {
|
||||||
repos = append(repos, fmt.Sprintf("%v:%v", repoName, tag))
|
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) {
|
func testConcurrentPullWholeRepo(c *check.C) {
|
||||||
repoName := fmt.Sprintf("%v/dockercli/busybox", privateRegistryURL)
|
repoName := fmt.Sprintf("%v/dockercli/busybox", privateRegistryURL)
|
||||||
|
|
||||||
repos := []string{}
|
var repos []string
|
||||||
for _, tag := range []string{"recent", "fresh", "todays"} {
|
for _, tag := range []string{"recent", "fresh", "todays"} {
|
||||||
repo := fmt.Sprintf("%v:%v", repoName, tag)
|
repo := fmt.Sprintf("%v:%v", repoName, tag)
|
||||||
buildImageSuccessfully(c, repo, build.WithDockerfile(fmt.Sprintf(`
|
buildImageSuccessfully(c, repo, build.WithDockerfile(fmt.Sprintf(`
|
||||||
|
@ -151,7 +151,7 @@ func (s *DockerSchema1RegistrySuite) testConcurrentFailingPull(c *check.C) {
|
||||||
func testConcurrentPullMultipleTags(c *check.C) {
|
func testConcurrentPullMultipleTags(c *check.C) {
|
||||||
repoName := fmt.Sprintf("%v/dockercli/busybox", privateRegistryURL)
|
repoName := fmt.Sprintf("%v/dockercli/busybox", privateRegistryURL)
|
||||||
|
|
||||||
repos := []string{}
|
var repos []string
|
||||||
for _, tag := range []string{"recent", "fresh", "todays"} {
|
for _, tag := range []string{"recent", "fresh", "todays"} {
|
||||||
repo := fmt.Sprintf("%v:%v", repoName, tag)
|
repo := fmt.Sprintf("%v:%v", repoName, tag)
|
||||||
buildImageSuccessfully(c, repo, build.WithDockerfile(fmt.Sprintf(`
|
buildImageSuccessfully(c, repo, build.WithDockerfile(fmt.Sprintf(`
|
||||||
|
|
|
@ -155,7 +155,7 @@ func (s *DockerSchema1RegistrySuite) TestPushEmptyLayer(c *check.C) {
|
||||||
func testConcurrentPush(c *check.C) {
|
func testConcurrentPush(c *check.C) {
|
||||||
repoName := fmt.Sprintf("%v/dockercli/busybox", privateRegistryURL)
|
repoName := fmt.Sprintf("%v/dockercli/busybox", privateRegistryURL)
|
||||||
|
|
||||||
repos := []string{}
|
var repos []string
|
||||||
for _, tag := range []string{"push1", "push2", "push3"} {
|
for _, tag := range []string{"push1", "push2", "push3"} {
|
||||||
repo := fmt.Sprintf("%v:%v", repoName, tag)
|
repo := fmt.Sprintf("%v:%v", repoName, tag)
|
||||||
buildImageSuccessfully(c, repo, build.WithDockerfile(fmt.Sprintf(`
|
buildImageSuccessfully(c, repo, build.WithDockerfile(fmt.Sprintf(`
|
||||||
|
|
|
@ -19,7 +19,7 @@ import (
|
||||||
"github.com/docker/docker/integration-cli/cli/build"
|
"github.com/docker/docker/integration-cli/cli/build"
|
||||||
"github.com/go-check/check"
|
"github.com/go-check/check"
|
||||||
"github.com/gotestyourself/gotestyourself/icmd"
|
"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
|
// 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)
|
testRequires(c, DaemonIsLinux)
|
||||||
repoName := "busybox:latest"
|
repoName := "busybox:latest"
|
||||||
out, _ := dockerCmd(c, "inspect", repoName)
|
out, _ := dockerCmd(c, "inspect", repoName)
|
||||||
data := []struct {
|
var data []struct {
|
||||||
ID string
|
ID string
|
||||||
Created time.Time
|
Created time.Time
|
||||||
}{}
|
}
|
||||||
err := json.Unmarshal([]byte(out), &data)
|
err := json.Unmarshal([]byte(out), &data)
|
||||||
c.Assert(err, checker.IsNil, check.Commentf("failed to marshal from %q: err %v", repoName, err))
|
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))
|
c.Assert(len(data), checker.Not(checker.Equals), 0, check.Commentf("failed to marshal the data from %q", repoName))
|
||||||
|
|
|
@ -16,7 +16,7 @@ import (
|
||||||
func (s *DockerSuite) TestClientSetsTLSServerName(c *check.C) {
|
func (s *DockerSuite) TestClientSetsTLSServerName(c *check.C) {
|
||||||
c.Skip("Flakey test")
|
c.Skip("Flakey test")
|
||||||
// there may be more than one hit to the server for each registry request
|
// there may be more than one hit to the server for each registry request
|
||||||
serverNameReceived := []string{}
|
var serverNameReceived []string
|
||||||
var serverName string
|
var serverName string
|
||||||
|
|
||||||
virtualHostServer := httptest.NewTLSServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
virtualHostServer := httptest.NewTLSServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
|
|
@ -2,7 +2,6 @@ package environment // import "github.com/docker/docker/integration-cli/environm
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
"os/exec"
|
"os/exec"
|
||||||
|
|
||||||
"github.com/docker/docker/internal/test/environment"
|
"github.com/docker/docker/internal/test/environment"
|
||||||
|
|
|
@ -119,7 +119,7 @@ type elementListOptions struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func existingElements(c *check.C, opts elementListOptions) []string {
|
func existingElements(c *check.C, opts elementListOptions) []string {
|
||||||
args := []string{}
|
var args []string
|
||||||
switch opts.element {
|
switch opts.element {
|
||||||
case "container":
|
case "container":
|
||||||
args = append(args, "ps", "-a")
|
args = append(args, "ps", "-a")
|
||||||
|
@ -136,7 +136,7 @@ func existingElements(c *check.C, opts elementListOptions) []string {
|
||||||
args = append(args, "--format", opts.format)
|
args = append(args, "--format", opts.format)
|
||||||
}
|
}
|
||||||
out, _ := dockerCmd(c, args...)
|
out, _ := dockerCmd(c, args...)
|
||||||
lines := []string{}
|
var lines []string
|
||||||
for _, l := range strings.Split(out, "\n") {
|
for _, l := range strings.Split(out, "\n") {
|
||||||
if l != "" {
|
if l != "" {
|
||||||
lines = append(lines, l)
|
lines = append(lines, l)
|
||||||
|
|
|
@ -443,7 +443,7 @@ type buildLine struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func getImageIDsFromBuild(output []byte) ([]string, error) {
|
func getImageIDsFromBuild(output []byte) ([]string, error) {
|
||||||
ids := []string{}
|
var ids []string
|
||||||
for _, line := range bytes.Split(output, []byte("\n")) {
|
for _, line := range bytes.Split(output, []byte("\n")) {
|
||||||
if len(line) == 0 {
|
if len(line) == 0 {
|
||||||
continue
|
continue
|
||||||
|
|
|
@ -46,7 +46,7 @@ func TestConfigList(t *testing.T) {
|
||||||
config1ID := createConfig(ctx, t, client, testName1, []byte("TESTINGDATA1"), map[string]string{"type": "production"})
|
config1ID := createConfig(ctx, t, client, testName1, []byte("TESTINGDATA1"), map[string]string{"type": "production"})
|
||||||
|
|
||||||
names := func(entries []swarmtypes.Config) []string {
|
names := func(entries []swarmtypes.Config) []string {
|
||||||
values := []string{}
|
var values []string
|
||||||
for _, entry := range entries {
|
for _, entry := range entries {
|
||||||
values = append(values, entry.Spec.Name)
|
values = append(values, entry.Spec.Name)
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,7 +51,7 @@ func TestPause(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestPauseFailsOnWindowsServerContainers(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)()
|
defer setupTest(t)()
|
||||||
client := request.NewAPIClient(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 {
|
func getEventActions(t *testing.T, messages <-chan events.Message, errs <-chan error) []string {
|
||||||
actions := []string{}
|
var actions []string
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case err := <-errs:
|
case err := <-errs:
|
||||||
|
|
|
@ -22,7 +22,7 @@ func TestPsFilter(t *testing.T) {
|
||||||
next := container.Create(t, ctx, client)
|
next := container.Create(t, ctx, client)
|
||||||
|
|
||||||
containerIDs := func(containers []types.Container) []string {
|
containerIDs := func(containers []types.Container) []string {
|
||||||
entries := []string{}
|
var entries []string
|
||||||
for _, container := range containers {
|
for _, container := range containers {
|
||||||
entries = append(entries, container.ID)
|
entries = append(entries, container.ID)
|
||||||
}
|
}
|
||||||
|
|
|
@ -173,8 +173,8 @@ func TestDaemonRestartWithExistingNetworkWithDefaultPoolRange(t *testing.T) {
|
||||||
out1, err := cli.NetworkInspect(context.Background(), name, types.NetworkInspectOptions{})
|
out1, err := cli.NetworkInspect(context.Background(), name, types.NetworkInspectOptions{})
|
||||||
assert.NilError(t, err)
|
assert.NilError(t, err)
|
||||||
|
|
||||||
assert.Check(t, (out1.IPAM.Config[0].Subnet != networkip))
|
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 != networkip2)
|
||||||
delInterface(t, defaultNetworkBridge)
|
delInterface(t, defaultNetworkBridge)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -63,7 +63,7 @@ func TestSecretList(t *testing.T) {
|
||||||
secret1ID := createSecret(ctx, t, client, testName1, []byte("TESTINGDATA1"), map[string]string{"type": "production"})
|
secret1ID := createSecret(ctx, t, client, testName1, []byte("TESTINGDATA1"), map[string]string{"type": "production"})
|
||||||
|
|
||||||
names := func(entries []swarmtypes.Secret) []string {
|
names := func(entries []swarmtypes.Secret) []string {
|
||||||
values := []string{}
|
var values []string
|
||||||
for _, entry := range entries {
|
for _, entry := range entries {
|
||||||
values = append(values, entry.Spec.Name)
|
values = append(values, entry.Spec.Name)
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,7 +77,7 @@ func getExistingContainers(t assert.TestingT, testEnv *Execution) []string {
|
||||||
})
|
})
|
||||||
assert.NilError(t, err, "failed to list containers")
|
assert.NilError(t, err, "failed to list containers")
|
||||||
|
|
||||||
containers := []string{}
|
var containers []string
|
||||||
for _, container := range containerList {
|
for _, container := range containerList {
|
||||||
containers = append(containers, container.ID)
|
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")
|
assert.NilError(t, err, "failed to list images")
|
||||||
|
|
||||||
images := []string{}
|
var images []string
|
||||||
for _, image := range imageList {
|
for _, image := range imageList {
|
||||||
images = append(images, tagsFromImageSummary(image)...)
|
images = append(images, tagsFromImageSummary(image)...)
|
||||||
}
|
}
|
||||||
|
@ -129,7 +129,7 @@ func getExistingImages(t assert.TestingT, testEnv *Execution) []string {
|
||||||
}
|
}
|
||||||
|
|
||||||
func tagsFromImageSummary(image types.ImageSummary) []string {
|
func tagsFromImageSummary(image types.ImageSummary) []string {
|
||||||
result := []string{}
|
var result []string
|
||||||
for _, tag := range image.RepoTags {
|
for _, tag := range image.RepoTags {
|
||||||
if tag != "<none>:<none>" {
|
if tag != "<none>:<none>" {
|
||||||
result = append(result, 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{})
|
networkList, err := client.NetworkList(context.Background(), types.NetworkListOptions{})
|
||||||
assert.NilError(t, err, "failed to list networks")
|
assert.NilError(t, err, "failed to list networks")
|
||||||
|
|
||||||
networks := []string{}
|
var networks []string
|
||||||
for _, network := range networkList {
|
for _, network := range networkList {
|
||||||
networks = append(networks, network.ID)
|
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")
|
assert.NilError(t, err, "failed to list plugins")
|
||||||
|
|
||||||
plugins := []string{}
|
var plugins []string
|
||||||
for _, plugin := range pluginList {
|
for _, plugin := range pluginList {
|
||||||
plugins = append(plugins, plugin.Name)
|
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{})
|
volumeList, err := client.VolumeList(context.Background(), filters.Args{})
|
||||||
assert.NilError(t, err, "failed to list volumes")
|
assert.NilError(t, err, "failed to list volumes")
|
||||||
|
|
||||||
volumes := []string{}
|
var volumes []string
|
||||||
for _, volume := range volumeList.Volumes {
|
for _, volume := range volumeList.Volumes {
|
||||||
volumes = append(volumes, volume.Name)
|
volumes = append(volumes, volume.Name)
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@ import (
|
||||||
"github.com/containerd/containerd"
|
"github.com/containerd/containerd"
|
||||||
"github.com/containerd/containerd/cio"
|
"github.com/containerd/containerd/cio"
|
||||||
"github.com/docker/docker/pkg/idtools"
|
"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"
|
"github.com/sirupsen/logrus"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/containerd/cgroups"
|
"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
|
// Summary is not used on linux
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package v1 // import "github.com/docker/docker/migrate/v1"
|
package v1 // import "github.com/docker/docker/migrate/v1"
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
|
@ -11,8 +12,6 @@ import (
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"encoding/json"
|
|
||||||
|
|
||||||
"github.com/docker/distribution/reference"
|
"github.com/docker/distribution/reference"
|
||||||
"github.com/docker/docker/distribution/metadata"
|
"github.com/docker/docker/distribution/metadata"
|
||||||
"github.com/docker/docker/image"
|
"github.com/docker/docker/image"
|
||||||
|
|
|
@ -8,7 +8,7 @@ import (
|
||||||
|
|
||||||
"github.com/opencontainers/runc/libcontainer/configs"
|
"github.com/opencontainers/runc/libcontainer/configs"
|
||||||
"github.com/opencontainers/runc/libcontainer/devices"
|
"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.
|
// Device transforms a libcontainer configs.Device to a specs.LinuxDevice object.
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package oci // import "github.com/docker/docker/oci"
|
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`
|
// RemoveNamespace removes the `nsType` namespace from OCI spec `s`
|
||||||
func RemoveNamespace(s *specs.Spec, nsType specs.LinuxNamespaceType) {
|
func RemoveNamespace(s *specs.Spec, nsType specs.LinuxNamespaceType) {
|
||||||
|
|
|
@ -65,7 +65,7 @@ func (p *PoolsOpt) Type() string {
|
||||||
|
|
||||||
// String returns a string repr of this option
|
// String returns a string repr of this option
|
||||||
func (p *PoolsOpt) String() string {
|
func (p *PoolsOpt) String() string {
|
||||||
pools := []string{}
|
var pools []string
|
||||||
for _, pool := range p.values {
|
for _, pool := range p.values {
|
||||||
repr := fmt.Sprintf("%s %d", pool.Base, pool.Size)
|
repr := fmt.Sprintf("%s %d", pool.Base, pool.Size)
|
||||||
pools = append(pools, repr)
|
pools = append(pools, repr)
|
||||||
|
|
10
opts/opts.go
10
opts/opts.go
|
@ -7,7 +7,7 @@ import (
|
||||||
"regexp"
|
"regexp"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
units "github.com/docker/go-units"
|
"github.com/docker/go-units"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -52,7 +52,7 @@ func (opts *ListOpts) Set(value string) error {
|
||||||
}
|
}
|
||||||
value = v
|
value = v
|
||||||
}
|
}
|
||||||
(*opts.values) = append((*opts.values), value)
|
*opts.values = append(*opts.values, value)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,7 +60,7 @@ func (opts *ListOpts) Set(value string) error {
|
||||||
func (opts *ListOpts) Delete(key string) {
|
func (opts *ListOpts) Delete(key string) {
|
||||||
for i, k := range *opts.values {
|
for i, k := range *opts.values {
|
||||||
if k == key {
|
if k == key {
|
||||||
(*opts.values) = append((*opts.values)[:i], (*opts.values)[i+1:]...)
|
*opts.values = append((*opts.values)[:i], (*opts.values)[i+1:]...)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -78,7 +78,7 @@ func (opts *ListOpts) GetMap() map[string]struct{} {
|
||||||
|
|
||||||
// GetAll returns the values of slice.
|
// GetAll returns the values of slice.
|
||||||
func (opts *ListOpts) GetAll() []string {
|
func (opts *ListOpts) GetAll() []string {
|
||||||
return (*opts.values)
|
return *opts.values
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetAllOrEmpty returns the values of the slice
|
// 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.
|
// Len returns the amount of element in the slice.
|
||||||
func (opts *ListOpts) Len() int {
|
func (opts *ListOpts) Len() int {
|
||||||
return len((*opts.values))
|
return len(*opts.values)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Type returns a string name for this Option type
|
// Type returns a string name for this Option type
|
||||||
|
|
|
@ -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) {
|
func walkHeaders(r io.Reader) ([]tar.Header, error) {
|
||||||
t := tar.NewReader(r)
|
t := tar.NewReader(r)
|
||||||
headers := []tar.Header{}
|
var headers []tar.Header
|
||||||
for {
|
for {
|
||||||
hdr, err := t.Next()
|
hdr, err := t.Next()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -9,7 +9,7 @@ func timeToTimespec(time time.Time) (ts syscall.Timespec) {
|
||||||
if time.IsZero() {
|
if time.IsZero() {
|
||||||
// Return UTIME_OMIT special value
|
// Return UTIME_OMIT special value
|
||||||
ts.Sec = 0
|
ts.Sec = 0
|
||||||
ts.Nsec = ((1 << 30) - 2)
|
ts.Nsec = (1 << 30) - 2
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
return syscall.NsecToTimespec(time.UnixNano())
|
return syscall.NsecToTimespec(time.UnixNano())
|
||||||
|
|
|
@ -4,7 +4,6 @@ import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"errors"
|
"errors"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -216,7 +216,7 @@ func dmGetNextTargetFct(task *cdmTask, next unsafe.Pointer, start, length *uint6
|
||||||
}
|
}
|
||||||
|
|
||||||
func dmUdevSetSyncSupportFct(syncWithUdev int) {
|
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 {
|
func dmUdevGetSyncSupportFct() int {
|
||||||
|
|
|
@ -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 }
|
func (e ranges) Less(i, j int) bool { return e[i].Start < e[j].Start }
|
||||||
|
|
||||||
const (
|
const (
|
||||||
subuidFileName string = "/etc/subuid"
|
subuidFileName = "/etc/subuid"
|
||||||
subgidFileName string = "/etc/subgid"
|
subgidFileName = "/etc/subgid"
|
||||||
)
|
)
|
||||||
|
|
||||||
// MkdirAllAndChown creates a directory (include any along the path) and then modifies
|
// MkdirAllAndChown creates a directory (include any along the path) and then modifies
|
||||||
|
|
|
@ -8,9 +8,9 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
gotty "github.com/Nvveen/Gotty"
|
"github.com/Nvveen/Gotty"
|
||||||
"github.com/docker/docker/pkg/term"
|
"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
|
// RFC3339NanoFixed is time.RFC3339Nano with nanoseconds padded using zeros to
|
||||||
|
|
|
@ -20,7 +20,7 @@ func TestSendToOneSub(t *testing.T) {
|
||||||
|
|
||||||
func TestSendToMultipleSubs(t *testing.T) {
|
func TestSendToMultipleSubs(t *testing.T) {
|
||||||
p := NewPublisher(100*time.Millisecond, 10)
|
p := NewPublisher(100*time.Millisecond, 10)
|
||||||
subs := []chan interface{}{}
|
var subs []chan interface{}
|
||||||
subs = append(subs, p.Subscribe(), p.Subscribe(), p.Subscribe())
|
subs = append(subs, p.Subscribe(), p.Subscribe(), p.Subscribe())
|
||||||
|
|
||||||
p.Publish("hi")
|
p.Publish("hi")
|
||||||
|
@ -52,7 +52,7 @@ func TestEvictOneSub(t *testing.T) {
|
||||||
|
|
||||||
func TestClosePublisher(t *testing.T) {
|
func TestClosePublisher(t *testing.T) {
|
||||||
p := NewPublisher(100*time.Millisecond, 10)
|
p := NewPublisher(100*time.Millisecond, 10)
|
||||||
subs := []chan interface{}{}
|
var subs []chan interface{}
|
||||||
subs = append(subs, p.Subscribe(), p.Subscribe(), p.Subscribe())
|
subs = append(subs, p.Subscribe(), p.Subscribe(), p.Subscribe())
|
||||||
p.Close()
|
p.Close()
|
||||||
|
|
||||||
|
@ -99,7 +99,7 @@ func newTestSubscriber(p *Publisher) *testSubscriber {
|
||||||
// for testing with -race
|
// for testing with -race
|
||||||
func TestPubSubRace(t *testing.T) {
|
func TestPubSubRace(t *testing.T) {
|
||||||
p := NewPublisher(0, 1024)
|
p := NewPublisher(0, 1024)
|
||||||
var subs [](*testSubscriber)
|
var subs []*testSubscriber
|
||||||
for j := 0; j < 50; j++ {
|
for j := 0; j < 50; j++ {
|
||||||
subs = append(subs, newTestSubscriber(p))
|
subs = append(subs, newTestSubscriber(p))
|
||||||
}
|
}
|
||||||
|
@ -120,7 +120,7 @@ func BenchmarkPubSub(b *testing.B) {
|
||||||
for i := 0; i < b.N; i++ {
|
for i := 0; i < b.N; i++ {
|
||||||
b.StopTimer()
|
b.StopTimer()
|
||||||
p := NewPublisher(0, 1024)
|
p := NewPublisher(0, 1024)
|
||||||
var subs [](*testSubscriber)
|
var subs []*testSubscriber
|
||||||
for j := 0; j < 50; j++ {
|
for j := 0; j < 50; j++ {
|
||||||
subs = append(subs, newTestSubscriber(p))
|
subs = append(subs, newTestSubscriber(p))
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,7 @@ import (
|
||||||
|
|
||||||
// CatchAll catches all signals and relays them to the specified channel.
|
// CatchAll catches all signals and relays them to the specified channel.
|
||||||
func CatchAll(sigc chan os.Signal) {
|
func CatchAll(sigc chan os.Signal) {
|
||||||
handledSigs := []os.Signal{}
|
var handledSigs []os.Signal
|
||||||
for _, s := range SignalMap {
|
for _, s := range SignalMap {
|
||||||
handledSigs = append(handledSigs, s)
|
handledSigs = append(handledSigs, s)
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@ import (
|
||||||
"os"
|
"os"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
ansiterm "github.com/Azure/go-ansiterm"
|
"github.com/Azure/go-ansiterm"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ import (
|
||||||
|
|
||||||
// Test the behavior of TruncIndex, an index for querying IDs from a non-conflicting prefix.
|
// Test the behavior of TruncIndex, an index for querying IDs from a non-conflicting prefix.
|
||||||
func TestTruncIndex(t *testing.T) {
|
func TestTruncIndex(t *testing.T) {
|
||||||
ids := []string{}
|
var ids []string
|
||||||
index := NewTruncIndex(ids)
|
index := NewTruncIndex(ids)
|
||||||
// Get on an empty index
|
// Get on an empty index
|
||||||
if _, err := index.Get("foobar"); err == nil {
|
if _, err := index.Get("foobar"); err == nil {
|
||||||
|
|
|
@ -33,7 +33,7 @@ import (
|
||||||
"github.com/docker/docker/pkg/system"
|
"github.com/docker/docker/pkg/system"
|
||||||
"github.com/docker/docker/plugin/v2"
|
"github.com/docker/docker/plugin/v2"
|
||||||
refstore "github.com/docker/docker/reference"
|
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"
|
specs "github.com/opencontainers/image-spec/specs-go/v1"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
|
|
|
@ -5,7 +5,7 @@ import (
|
||||||
|
|
||||||
"github.com/docker/docker/pkg/plugins"
|
"github.com/docker/docker/pkg/plugins"
|
||||||
"github.com/docker/docker/plugin/v2"
|
"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
|
// Store manages the plugin inventory in memory and on-disk
|
||||||
|
|
|
@ -10,7 +10,7 @@ import (
|
||||||
|
|
||||||
"github.com/docker/docker/libcontainerd"
|
"github.com/docker/docker/libcontainerd"
|
||||||
"github.com/gotestyourself/gotestyourself/assert"
|
"github.com/gotestyourself/gotestyourself/assert"
|
||||||
specs "github.com/opencontainers/runtime-spec/specs-go"
|
"github.com/opencontainers/runtime-spec/specs-go"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue