diff --git a/api/common.go b/api/common.go index beb251a989..4a0a5d5832 100644 --- a/api/common.go +++ b/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/api/common_unix.go b/api/common_unix.go index af1a541646..504b0c90d7 100644 --- a/api/common_unix.go +++ b/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/api/server/router/build/build_routes.go b/api/server/router/build/build_routes.go index 1261cf4777..3e3668c42b 100644 --- a/api/server/router/build/build_routes.go +++ b/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/api/server/server_test.go b/api/server/server_test.go index 3fbe1c9d13..e0fac30ab7 100644 --- a/api/server/server_test.go +++ b/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/api/types/client.go b/api/types/client.go index 18b36d592b..3d2e057c9a 100644 --- a/api/types/client.go +++ b/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/builder/builder.go b/builder/builder.go index 3c5edb0679..3eb0341417 100644 --- a/builder/builder.go +++ b/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/builder/dockerfile/buildargs.go b/builder/dockerfile/buildargs.go index 232f9d23f6..f9cceaa05c 100644 --- a/builder/dockerfile/buildargs.go +++ b/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/builder/dockerfile/builder.go b/builder/dockerfile/builder.go index 1455fd966e..890e7b89fd 100644 --- a/builder/dockerfile/builder.go +++ b/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/builder/dockerfile/instructions/commands.go b/builder/dockerfile/instructions/commands.go index 633a2b3fc7..96d33016b5 100644 --- a/builder/dockerfile/instructions/commands.go +++ b/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/builder/dockerfile/instructions/support_test.go b/builder/dockerfile/instructions/support_test.go index 5c79e383db..0332c524e8 100644 --- a/builder/dockerfile/instructions/support_test.go +++ b/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/builder/dockerfile/parser/parser.go b/builder/dockerfile/parser/parser.go index b065b8a4ea..f938b808b6 100644 --- a/builder/dockerfile/parser/parser.go +++ b/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/builder/dockerfile/shell/lex_test.go b/builder/dockerfile/shell/lex_test.go index 7a726ad79b..f38da2026f 100644 --- a/builder/dockerfile/shell/lex_test.go +++ b/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/builder/remotecontext/tarsum.go b/builder/remotecontext/tarsum.go index 9e8c7d6072..b809cfb78b 100644 --- a/builder/remotecontext/tarsum.go +++ b/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/cli/cobra.go b/cli/cobra.go index 7c4196e141..8ed1fddc06 100644 --- a/cli/cobra.go +++ b/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/client/container_wait_test.go b/client/container_wait_test.go index e18e1376f1..11a9203ddc 100644 --- a/client/container_wait_test.go +++ b/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/client/errors.go b/client/errors.go index 05c1246276..0461af329d 100644 --- a/client/errors.go +++ b/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/client/image_save_test.go b/client/image_save_test.go index f79efc654d..a40055e583 100644 --- a/client/image_save_test.go +++ b/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/client/node_remove.go b/client/node_remove.go index c07fc0eb39..e7a7505715 100644 --- a/client/node_remove.go +++ b/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/client/node_remove_test.go b/client/node_remove_test.go index d30e718db1..85f828b849 100644 --- a/client/node_remove_test.go +++ b/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/client/plugin_remove_test.go b/client/plugin_remove_test.go index a037ae2a13..e6c76342ee 100644 --- a/client/plugin_remove_test.go +++ b/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/client/request_test.go b/client/request_test.go index 704a122c08..e45a8651a0 100644 --- a/client/request_test.go +++ b/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/client/service_create.go b/client/service_create.go index 8d08271689..8fadda4a90 100644 --- a/client/service_create.go +++ b/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/cmd/dockerd/config_unix.go b/cmd/dockerd/config_unix.go index 37acd38be4..2dbd84b1db 100644 --- a/cmd/dockerd/config_unix.go +++ b/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/cmd/dockerd/metrics.go b/cmd/dockerd/metrics.go index 99d41cb3aa..20ceaf8466 100644 --- a/cmd/dockerd/metrics.go +++ b/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/container/view.go b/container/view.go index baf6fe7195..b631499412 100644 --- a/container/view.go +++ b/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/daemon/cluster/convert/container.go b/daemon/cluster/convert/container.go index baf02a996c..0a34fc73e4 100644 --- a/daemon/cluster/convert/container.go +++ b/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/daemon/cluster/executor/container/container_test.go b/daemon/cluster/executor/container/container_test.go index 1e94171974..f9e8c8a92e 100644 --- a/daemon/cluster/executor/container/container_test.go +++ b/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/daemon/config/config_unix.go b/daemon/config/config_unix.go index ee091b8bfe..1970928f9b 100644 --- a/daemon/config/config_unix.go +++ b/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/daemon/config/config_unix_test.go b/daemon/config/config_unix_test.go index 53eb428264..d9bb9476ac 100644 --- a/daemon/config/config_unix_test.go +++ b/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/daemon/daemon_unix.go b/daemon/daemon_unix.go index f6f0f166bd..e2c77610d4 100644 --- a/daemon/daemon_unix.go +++ b/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/daemon/exec.go b/daemon/exec.go index a279f246e6..289c6bfb30 100644 --- a/daemon/exec.go +++ b/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/daemon/graphdriver/aufs/dirs.go b/daemon/graphdriver/aufs/dirs.go index 1ee47e40f6..e60be5e3c9 100644 --- a/daemon/graphdriver/aufs/dirs.go +++ b/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/daemon/graphdriver/devmapper/deviceset.go b/daemon/graphdriver/devmapper/deviceset.go index dafe7661a2..2bfbf05a27 100644 --- a/daemon/graphdriver/devmapper/deviceset.go +++ b/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/daemon/graphdriver/devmapper/driver.go b/daemon/graphdriver/devmapper/driver.go index 1384a3a157..df883de31d 100644 --- a/daemon/graphdriver/devmapper/driver.go +++ b/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/daemon/graphdriver/graphtest/graphtest_unix.go b/daemon/graphdriver/graphtest/graphtest_unix.go index 1e068535f3..5ac3979752 100644 --- a/daemon/graphdriver/graphtest/graphtest_unix.go +++ b/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/daemon/graphdriver/graphtest/testutil.go b/daemon/graphdriver/graphtest/testutil.go index ea9952858f..258aba7002 100644 --- a/daemon/graphdriver/graphtest/testutil.go +++ b/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/daemon/graphdriver/vfs/driver.go b/daemon/graphdriver/vfs/driver.go index c23c882ab2..e51cb6c250 100644 --- a/daemon/graphdriver/vfs/driver.go +++ b/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/daemon/graphdriver/zfs/zfs.go b/daemon/graphdriver/zfs/zfs.go index eeceb4d3b8..1d9153e171 100644 --- a/daemon/graphdriver/zfs/zfs.go +++ b/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/daemon/images/image_delete.go b/daemon/images/image_delete.go index 60896e487a..94d6f872dd 100644 --- a/daemon/images/image_delete.go +++ b/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/daemon/images/image_prune.go b/daemon/images/image_prune.go index da7f81322f..dd55347cf0 100644 --- a/daemon/images/image_prune.go +++ b/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/daemon/images/locals.go b/daemon/images/locals.go index a57ea2da60..5ffc460a09 100644 --- a/daemon/images/locals.go +++ b/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/daemon/logger/adapter.go b/daemon/logger/adapter.go index 5b9252d324..95aff9bf3b 100644 --- a/daemon/logger/adapter.go +++ b/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/daemon/logger/awslogs/cloudwatchlogs_test.go b/daemon/logger/awslogs/cloudwatchlogs_test.go index 2884f01e28..b8e49055e8 100644 --- a/daemon/logger/awslogs/cloudwatchlogs_test.go +++ b/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/daemon/logger/factory.go b/daemon/logger/factory.go index 9723f7fc0c..84b54b2794 100644 --- a/daemon/logger/factory.go +++ b/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/daemon/logger/gcplogs/gcplogging.go b/daemon/logger/gcplogs/gcplogging.go index 08b632b627..1699f67a2d 100644 --- a/daemon/logger/gcplogs/gcplogging.go +++ b/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/daemon/logger/jsonfilelog/jsonfilelog.go b/daemon/logger/jsonfilelog/jsonfilelog.go index 7d0533ec84..b806a5ad17 100644 --- a/daemon/logger/jsonfilelog/jsonfilelog.go +++ b/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/daemon/logger/loggerutils/multireader/multireader_test.go b/daemon/logger/loggerutils/multireader/multireader_test.go index 15461c40de..2fb66ab566 100644 --- a/daemon/logger/loggerutils/multireader/multireader_test.go +++ b/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/daemon/metrics.go b/daemon/metrics.go index 02a36603c9..8ee6432eaa 100644 --- a/daemon/metrics.go +++ b/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/daemon/metrics_unix.go b/daemon/metrics_unix.go index fbf561e917..9311915249 100644 --- a/daemon/metrics_unix.go +++ b/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/daemon/oci_linux.go b/daemon/oci_linux.go index 49ba0e13c3..b675eaf406 100644 --- a/daemon/oci_linux.go +++ b/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/daemon/reload_test.go b/daemon/reload_test.go index 9174bfba54..f20126452a 100644 --- a/daemon/reload_test.go +++ b/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/daemon/update_linux.go b/daemon/update_linux.go index 14bd91446a..6a307eabc5 100644 --- a/daemon/update_linux.go +++ b/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/distribution/errors_test.go b/distribution/errors_test.go index 95c40e8a04..7105bdb4d6 100644 --- a/distribution/errors_test.go +++ b/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/distribution/pull_v2.go b/distribution/pull_v2.go index 93b9a5a6f0..60a894b1c3 100644 --- a/distribution/pull_v2.go +++ b/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/distribution/push_v2.go b/distribution/push_v2.go index 5e360591f4..9dc3e7a2a6 100644 --- a/distribution/push_v2.go +++ b/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/dockerversion/version_lib.go b/dockerversion/version_lib.go index 1489be0a25..0897c0728e 100644 --- a/dockerversion/version_lib.go +++ b/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/hack/integration-cli-on-swarm/agent/master/set_test.go b/hack/integration-cli-on-swarm/agent/master/set_test.go index dfb7a0b4f8..c172562b1b 100644 --- a/hack/integration-cli-on-swarm/agent/master/set_test.go +++ b/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/image/tarexport/load.go b/image/tarexport/load.go index 4d120068b6..c89dd08f93 100644 --- a/image/tarexport/load.go +++ b/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/integration-cli/docker_api_build_test.go b/integration-cli/docker_api_build_test.go index 594185f14d..581df8d5c7 100644 --- a/integration-cli/docker_api_build_test.go +++ b/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/integration-cli/docker_api_network_test.go b/integration-cli/docker_api_network_test.go index c159c80a0a..9c22cb7e3a 100644 --- a/integration-cli/docker_api_network_test.go +++ b/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/integration-cli/docker_cli_build_test.go b/integration-cli/docker_cli_build_test.go index e4edc8e642..a87e4aaaf1 100644 --- a/integration-cli/docker_cli_build_test.go +++ b/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/integration-cli/docker_cli_build_unix_test.go b/integration-cli/docker_cli_build_unix_test.go index f2d598ef58..d6c4370064 100644 --- a/integration-cli/docker_cli_build_unix_test.go +++ b/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/integration-cli/docker_cli_create_test.go b/integration-cli/docker_cli_create_test.go index bf7096123b..9ec400b2e1 100644 --- a/integration-cli/docker_cli_create_test.go +++ b/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/integration-cli/docker_cli_daemon_test.go b/integration-cli/docker_cli_daemon_test.go index 5015736a31..347696e8a4 100644 --- a/integration-cli/docker_cli_daemon_test.go +++ b/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/integration-cli/docker_cli_exec_test.go b/integration-cli/docker_cli_exec_test.go index 9804b3a643..d0557c56a0 100644 --- a/integration-cli/docker_cli_exec_test.go +++ b/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/integration-cli/docker_cli_network_unix_test.go b/integration-cli/docker_cli_network_unix_test.go index f3ecd62187..1087d0045d 100644 --- a/integration-cli/docker_cli_network_unix_test.go +++ b/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/integration-cli/docker_cli_ps_test.go b/integration-cli/docker_cli_ps_test.go index fea51dd0bd..771c9d70d5 100644 --- a/integration-cli/docker_cli_ps_test.go +++ b/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/integration-cli/docker_cli_pull_local_test.go b/integration-cli/docker_cli_pull_local_test.go index 79b9390d28..31afdfb539 100644 --- a/integration-cli/docker_cli_pull_local_test.go +++ b/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/integration-cli/docker_cli_push_test.go b/integration-cli/docker_cli_push_test.go index 48d6be2ac1..382260a5c7 100644 --- a/integration-cli/docker_cli_push_test.go +++ b/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/integration-cli/docker_cli_save_load_test.go b/integration-cli/docker_cli_save_load_test.go index 3077c0b46d..d370b6cc5e 100644 --- a/integration-cli/docker_cli_save_load_test.go +++ b/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/integration-cli/docker_cli_sni_test.go b/integration-cli/docker_cli_sni_test.go index fb896d52d5..f50b5bbf6d 100644 --- a/integration-cli/docker_cli_sni_test.go +++ b/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/integration-cli/environment/environment.go b/integration-cli/environment/environment.go index 2d7702f14c..82cf99652b 100644 --- a/integration-cli/environment/environment.go +++ b/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/integration-cli/utils_test.go b/integration-cli/utils_test.go index 6c18c222d2..33913c3922 100644 --- a/integration-cli/utils_test.go +++ b/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/integration/build/build_test.go b/integration/build/build_test.go index 352f7c152d..83d992d14f 100644 --- a/integration/build/build_test.go +++ b/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/integration/config/config_test.go b/integration/config/config_test.go index d698445f2b..1c002423ea 100644 --- a/integration/config/config_test.go +++ b/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/integration/container/pause_test.go b/integration/container/pause_test.go index 8854dd9fd9..8f856bcb3c 100644 --- a/integration/container/pause_test.go +++ b/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/integration/container/ps_test.go b/integration/container/ps_test.go index 7ee92481e9..1080cd2f57 100644 --- a/integration/container/ps_test.go +++ b/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/integration/network/service_test.go b/integration/network/service_test.go index 2ae1897c6d..9b0c027598 100644 --- a/integration/network/service_test.go +++ b/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/integration/secret/secret_test.go b/integration/secret/secret_test.go index 96a02a6ec5..9c5617efc6 100644 --- a/integration/secret/secret_test.go +++ b/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/internal/test/environment/protect.go b/internal/test/environment/protect.go index 59acdf418e..6d57dedb1c 100644 --- a/internal/test/environment/protect.go +++ b/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/libcontainerd/client_daemon_linux.go b/libcontainerd/client_daemon_linux.go index a2237dc9f5..b57c4d3c50 100644 --- a/libcontainerd/client_daemon_linux.go +++ b/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/libcontainerd/types_linux.go b/libcontainerd/types_linux.go index ae7a757c65..943382b9b0 100644 --- a/libcontainerd/types_linux.go +++ b/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/migrate/v1/migratev1.go b/migrate/v1/migratev1.go index 4777c16c55..9cd759a3b8 100644 --- a/migrate/v1/migratev1.go +++ b/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/oci/devices_linux.go b/oci/devices_linux.go index 7f1658e53c..46d4e1d32d 100644 --- a/oci/devices_linux.go +++ b/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/oci/namespaces.go b/oci/namespaces.go index f32e489b4a..5a2d8f2087 100644 --- a/oci/namespaces.go +++ b/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/opts/address_pools.go b/opts/address_pools.go index 99c89bb626..9b27a62853 100644 --- a/opts/address_pools.go +++ b/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/opts/opts.go b/opts/opts.go index bfdcb996b0..de8aacb806 100644 --- a/opts/opts.go +++ b/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/pkg/archive/changes_posix_test.go b/pkg/archive/changes_posix_test.go index 76ee40bb60..019a0250f3 100644 --- a/pkg/archive/changes_posix_test.go +++ b/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/pkg/archive/time_linux.go b/pkg/archive/time_linux.go index 58aefe3efb..797143ee84 100644 --- a/pkg/archive/time_linux.go +++ b/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/pkg/broadcaster/unbuffered_test.go b/pkg/broadcaster/unbuffered_test.go index 2d885c77c1..c510584aa3 100644 --- a/pkg/broadcaster/unbuffered_test.go +++ b/pkg/broadcaster/unbuffered_test.go @@ -4,7 +4,6 @@ import ( "bytes" "errors" "strings" - "testing" ) diff --git a/pkg/devicemapper/devmapper_wrapper.go b/pkg/devicemapper/devmapper_wrapper.go index 8e28f642da..0b88f49695 100644 --- a/pkg/devicemapper/devmapper_wrapper.go +++ b/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/pkg/idtools/idtools.go b/pkg/idtools/idtools.go index e2b493158c..d1f173a311 100644 --- a/pkg/idtools/idtools.go +++ b/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/pkg/jsonmessage/jsonmessage.go b/pkg/jsonmessage/jsonmessage.go index 7e5c95b58b..dd95f36704 100644 --- a/pkg/jsonmessage/jsonmessage.go +++ b/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/pkg/pubsub/publisher_test.go b/pkg/pubsub/publisher_test.go index 37bd6ece9d..98e158248f 100644 --- a/pkg/pubsub/publisher_test.go +++ b/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/pkg/signal/signal.go b/pkg/signal/signal.go index 6a663091a1..88ef7b5ea2 100644 --- a/pkg/signal/signal.go +++ b/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/pkg/term/windows/windows.go b/pkg/term/windows/windows.go index 1f8965969c..3e5593ca6a 100644 --- a/pkg/term/windows/windows.go +++ b/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/pkg/truncindex/truncindex_test.go b/pkg/truncindex/truncindex_test.go index 5977ca315f..e259017982 100644 --- a/pkg/truncindex/truncindex_test.go +++ b/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/plugin/backend_linux.go b/plugin/backend_linux.go index 4a6d80d243..044e14b0cb 100644 --- a/plugin/backend_linux.go +++ b/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/plugin/defs.go b/plugin/defs.go index c158bbbfe5..31f7c6bcc3 100644 --- a/plugin/defs.go +++ b/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/plugin/executor/containerd/containerd_test.go b/plugin/executor/containerd/containerd_test.go index cd1a51bd35..d9185a05e1 100644 --- a/plugin/executor/containerd/containerd_test.go +++ b/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/plugin/manager.go b/plugin/manager.go index 7595e7cbcc..9c674f9545 100644 --- a/plugin/manager.go +++ b/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/plugin/manager_linux_test.go b/plugin/manager_linux_test.go index 48048bb30f..d4199c80da 100644 --- a/plugin/manager_linux_test.go +++ b/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/plugin/store.go b/plugin/store.go index 5cb994b759..8e96c11da4 100644 --- a/plugin/store.go +++ b/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/plugin/v2/plugin.go b/plugin/v2/plugin.go index 558e49d31b..1c451691ce 100644 --- a/plugin/v2/plugin.go +++ b/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/plugin/v2/plugin_linux.go b/plugin/v2/plugin_linux.go index 4ad582cd83..58c432fcd6 100644 --- a/plugin/v2/plugin_linux.go +++ b/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/reference/store_test.go b/reference/store_test.go index 24c0597a3e..71f1d96e59 100644 --- a/reference/store_test.go +++ b/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/registry/config_test.go b/registry/config_test.go index 4df9cdb948..2f9c9548ea 100644 --- a/registry/config_test.go +++ b/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/registry/endpoint_v1.go b/registry/endpoint_v1.go index 94c56dca7d..832fdb95a4 100644 --- a/registry/endpoint_v1.go +++ b/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/registry/registry_mock_test.go b/registry/registry_mock_test.go index e6a4fca0cc..bf17eb9fc7 100644 --- a/registry/registry_mock_test.go +++ b/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/registry/registry_test.go b/registry/registry_test.go index 86620dfccf..ec11252394 100644 --- a/registry/registry_test.go +++ b/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/registry/session.go b/registry/session.go index 1d0bae2ca7..ef14299594 100644 --- a/registry/session.go +++ b/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/volume/local/local.go b/volume/local/local.go index b1eb2881b4..d97347423a 100644 --- a/volume/local/local.go +++ b/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 } }