remove unnescessary import aliases, brackets, and so on.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
| ... | ... |
@@ -3,9 +3,9 @@ package api // import "github.com/docker/docker/api" |
| 3 | 3 |
// Common constants for daemon and client. |
| 4 | 4 |
const ( |
| 5 | 5 |
// DefaultVersion of Current REST API |
| 6 |
- DefaultVersion string = "1.37" |
|
| 6 |
+ DefaultVersion = "1.37" |
|
| 7 | 7 |
|
| 8 | 8 |
// NoBaseImageSpecifier is the symbol used by the FROM |
| 9 | 9 |
// command to specify that no base image is to be used. |
| 10 |
- NoBaseImageSpecifier string = "scratch" |
|
| 10 |
+ NoBaseImageSpecifier = "scratch" |
|
| 11 | 11 |
) |
| ... | ... |
@@ -23,7 +23,7 @@ import ( |
| 23 | 23 |
"github.com/docker/docker/pkg/progress" |
| 24 | 24 |
"github.com/docker/docker/pkg/streamformatter" |
| 25 | 25 |
"github.com/docker/docker/pkg/system" |
| 26 |
- units "github.com/docker/go-units" |
|
| 26 |
+ "github.com/docker/go-units" |
|
| 27 | 27 |
"github.com/pkg/errors" |
| 28 | 28 |
"github.com/sirupsen/logrus" |
| 29 | 29 |
) |
| ... | ... |
@@ -1,13 +1,12 @@ |
| 1 | 1 |
package server // import "github.com/docker/docker/api/server" |
| 2 | 2 |
|
| 3 | 3 |
import ( |
| 4 |
+ "context" |
|
| 4 | 5 |
"net/http" |
| 5 | 6 |
"net/http/httptest" |
| 6 | 7 |
"strings" |
| 7 | 8 |
"testing" |
| 8 | 9 |
|
| 9 |
- "context" |
|
| 10 |
- |
|
| 11 | 10 |
"github.com/docker/docker/api" |
| 12 | 11 |
"github.com/docker/docker/api/server/httputils" |
| 13 | 12 |
"github.com/docker/docker/api/server/middleware" |
| ... | ... |
@@ -7,7 +7,7 @@ import ( |
| 7 | 7 |
|
| 8 | 8 |
"github.com/docker/docker/api/types/container" |
| 9 | 9 |
"github.com/docker/docker/api/types/filters" |
| 10 |
- units "github.com/docker/go-units" |
|
| 10 |
+ "github.com/docker/go-units" |
|
| 11 | 11 |
) |
| 12 | 12 |
|
| 13 | 13 |
// CheckpointCreateOptions holds parameters to create a checkpoint from a container |
| ... | ... |
@@ -19,7 +19,7 @@ import ( |
| 19 | 19 |
|
| 20 | 20 |
const ( |
| 21 | 21 |
// DefaultDockerfileName is the Default filename with Docker commands, read by docker build |
| 22 |
- DefaultDockerfileName string = "Dockerfile" |
|
| 22 |
+ DefaultDockerfileName = "Dockerfile" |
|
| 23 | 23 |
) |
| 24 | 24 |
|
| 25 | 25 |
// 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) {
|
| 69 | 69 |
// WarnOnUnusedBuildArgs checks if there are any leftover build-args that were |
| 70 | 70 |
// passed but not consumed during build. Print a warning, if there are any. |
| 71 | 71 |
func (b *BuildArgs) WarnOnUnusedBuildArgs(out io.Writer) {
|
| 72 |
- leftoverArgs := []string{}
|
|
| 72 |
+ var leftoverArgs []string |
|
| 73 | 73 |
for arg := range b.argsFromOptions {
|
| 74 | 74 |
_, isReferenced := b.referencedArgs[arg] |
| 75 | 75 |
_, isBuiltin := builtinAllowedBuildArgs[arg] |
| ... | ... |
@@ -387,7 +387,7 @@ func BuildFromConfig(config *container.Config, changes []string, os string) (*co |
| 387 | 387 |
b.Stderr = ioutil.Discard |
| 388 | 388 |
b.disableCommit = true |
| 389 | 389 |
|
| 390 |
- commands := []instructions.Command{}
|
|
| 390 |
+ var commands []instructions.Command |
|
| 391 | 391 |
for _, n := range dockerfile.AST.Children {
|
| 392 | 392 |
cmd, err := instructions.ParseCommand(n) |
| 393 | 393 |
if err != nil {
|
| ... | ... |
@@ -262,8 +262,7 @@ func Parse(rwc io.Reader) (*Result, error) {
|
| 262 | 262 |
} |
| 263 | 263 |
|
| 264 | 264 |
if hasEmptyContinuationLine {
|
| 265 |
- warning := "[WARNING]: Empty continuation line found in:\n " + line |
|
| 266 |
- warnings = append(warnings, warning) |
|
| 265 |
+ warnings = append(warnings, "[WARNING]: Empty continuation line found in:\n "+line) |
|
| 267 | 266 |
} |
| 268 | 267 |
|
| 269 | 268 |
child, err := newNodeFromLine(line, d) |
| ... | ... |
@@ -6,7 +6,7 @@ import ( |
| 6 | 6 |
|
| 7 | 7 |
"github.com/docker/docker/pkg/containerfs" |
| 8 | 8 |
iradix "github.com/hashicorp/go-immutable-radix" |
| 9 |
- digest "github.com/opencontainers/go-digest" |
|
| 9 |
+ "github.com/opencontainers/go-digest" |
|
| 10 | 10 |
"github.com/pkg/errors" |
| 11 | 11 |
"github.com/tonistiigi/fsutil" |
| 12 | 12 |
) |
| ... | ... |
@@ -51,7 +51,7 @@ func hasManagementSubCommands(cmd *cobra.Command) bool {
|
| 51 | 51 |
} |
| 52 | 52 |
|
| 53 | 53 |
func operationSubCommands(cmd *cobra.Command) []*cobra.Command {
|
| 54 |
- cmds := []*cobra.Command{}
|
|
| 54 |
+ var cmds []*cobra.Command |
|
| 55 | 55 |
for _, sub := range cmd.Commands() {
|
| 56 | 56 |
if sub.IsAvailableCommand() && !sub.HasSubCommands() {
|
| 57 | 57 |
cmds = append(cmds, sub) |
| ... | ... |
@@ -69,7 +69,7 @@ func wrappedFlagUsages(cmd *cobra.Command) string {
|
| 69 | 69 |
} |
| 70 | 70 |
|
| 71 | 71 |
func managementSubCommands(cmd *cobra.Command) []*cobra.Command {
|
| 72 |
- cmds := []*cobra.Command{}
|
|
| 72 |
+ var cmds []*cobra.Command |
|
| 73 | 73 |
for _, sub := range cmd.Commands() {
|
| 74 | 74 |
if sub.IsAvailableCommand() && sub.HasSubCommands() {
|
| 75 | 75 |
cmds = append(cmds, sub) |
| ... | ... |
@@ -2,6 +2,7 @@ package client // import "github.com/docker/docker/client" |
| 2 | 2 |
|
| 3 | 3 |
import ( |
| 4 | 4 |
"bytes" |
| 5 |
+ "context" |
|
| 5 | 6 |
"encoding/json" |
| 6 | 7 |
"fmt" |
| 7 | 8 |
"io/ioutil" |
| ... | ... |
@@ -11,8 +12,6 @@ import ( |
| 11 | 11 |
"testing" |
| 12 | 12 |
"time" |
| 13 | 13 |
|
| 14 |
- "context" |
|
| 15 |
- |
|
| 16 | 14 |
"github.com/docker/docker/api/types/container" |
| 17 | 15 |
) |
| 18 | 16 |
|
| ... | ... |
@@ -9,7 +9,7 @@ import ( |
| 9 | 9 |
"github.com/docker/distribution/reference" |
| 10 | 10 |
"github.com/docker/docker/api/types" |
| 11 | 11 |
"github.com/docker/docker/api/types/swarm" |
| 12 |
- digest "github.com/opencontainers/go-digest" |
|
| 12 |
+ "github.com/opencontainers/go-digest" |
|
| 13 | 13 |
"github.com/pkg/errors" |
| 14 | 14 |
) |
| 15 | 15 |
|
| ... | ... |
@@ -340,7 +340,7 @@ func (v *memdbView) transform(container *Container) *Snapshot {
|
| 340 | 340 |
} |
| 341 | 341 |
|
| 342 | 342 |
if len(container.Args) > 0 {
|
| 343 |
- args := []string{}
|
|
| 343 |
+ var args []string |
|
| 344 | 344 |
for _, arg := range container.Args {
|
| 345 | 345 |
if strings.Contains(arg, " ") {
|
| 346 | 346 |
args = append(args, fmt.Sprintf("'%s'", arg))
|
| ... | ... |
@@ -5,7 +5,7 @@ import ( |
| 5 | 5 |
"fmt" |
| 6 | 6 |
"strings" |
| 7 | 7 |
|
| 8 |
- container "github.com/docker/docker/api/types/container" |
|
| 8 |
+ "github.com/docker/docker/api/types/container" |
|
| 9 | 9 |
mounttypes "github.com/docker/docker/api/types/mount" |
| 10 | 10 |
types "github.com/docker/docker/api/types/swarm" |
| 11 | 11 |
swarmapi "github.com/docker/swarmkit/api" |
| ... | ... |
@@ -3,7 +3,7 @@ package container // import "github.com/docker/docker/daemon/cluster/executor/co |
| 3 | 3 |
import ( |
| 4 | 4 |
"testing" |
| 5 | 5 |
|
| 6 |
- container "github.com/docker/docker/api/types/container" |
|
| 6 |
+ "github.com/docker/docker/api/types/container" |
|
| 7 | 7 |
swarmapi "github.com/docker/swarmkit/api" |
| 8 | 8 |
"github.com/gotestyourself/gotestyourself/assert" |
| 9 | 9 |
) |
| ... | ... |
@@ -6,7 +6,7 @@ import ( |
| 6 | 6 |
"testing" |
| 7 | 7 |
|
| 8 | 8 |
"github.com/docker/docker/opts" |
| 9 |
- units "github.com/docker/go-units" |
|
| 9 |
+ "github.com/docker/go-units" |
|
| 10 | 10 |
"github.com/gotestyourself/gotestyourself/assert" |
| 11 | 11 |
is "github.com/gotestyourself/gotestyourself/assert/cmp" |
| 12 | 12 |
"github.com/gotestyourself/gotestyourself/fs" |
| ... | ... |
@@ -43,7 +43,7 @@ import ( |
| 43 | 43 |
lntypes "github.com/docker/libnetwork/types" |
| 44 | 44 |
"github.com/opencontainers/runc/libcontainer/cgroups" |
| 45 | 45 |
rsystem "github.com/opencontainers/runc/libcontainer/system" |
| 46 |
- specs "github.com/opencontainers/runtime-spec/specs-go" |
|
| 46 |
+ "github.com/opencontainers/runtime-spec/specs-go" |
|
| 47 | 47 |
"github.com/opencontainers/selinux/go-selinux/label" |
| 48 | 48 |
"github.com/pkg/errors" |
| 49 | 49 |
"github.com/sirupsen/logrus" |
| ... | ... |
@@ -67,8 +67,8 @@ const ( |
| 67 | 67 |
// It's not kernel limit, we want this 4M limit to supply a reasonable functional container |
| 68 | 68 |
linuxMinMemory = 4194304 |
| 69 | 69 |
// constants for remapped root settings |
| 70 |
- defaultIDSpecifier string = "default" |
|
| 71 |
- defaultRemappedID string = "dockremap" |
|
| 70 |
+ defaultIDSpecifier = "default" |
|
| 71 |
+ defaultRemappedID = "dockremap" |
|
| 72 | 72 |
|
| 73 | 73 |
// constant for cgroup drivers |
| 74 | 74 |
cgroupFsDriver = "cgroupfs" |
| ... | ... |
@@ -16,7 +16,7 @@ import ( |
| 16 | 16 |
"github.com/docker/docker/pkg/pools" |
| 17 | 17 |
"github.com/docker/docker/pkg/signal" |
| 18 | 18 |
"github.com/docker/docker/pkg/term" |
| 19 |
- specs "github.com/opencontainers/runtime-spec/specs-go" |
|
| 19 |
+ "github.com/opencontainers/runtime-spec/specs-go" |
|
| 20 | 20 |
"github.com/pkg/errors" |
| 21 | 21 |
"github.com/sirupsen/logrus" |
| 22 | 22 |
) |
| ... | ... |
@@ -15,7 +15,7 @@ func loadIds(root string) ([]string, error) {
|
| 15 | 15 |
if err != nil {
|
| 16 | 16 |
return nil, err |
| 17 | 17 |
} |
| 18 |
- out := []string{}
|
|
| 18 |
+ var out []string |
|
| 19 | 19 |
for _, d := range dirs {
|
| 20 | 20 |
if !d.IsDir() {
|
| 21 | 21 |
out = append(out, d.Name()) |
| ... | ... |
@@ -36,7 +36,7 @@ func getParentIDs(root, id string) ([]string, error) {
|
| 36 | 36 |
} |
| 37 | 37 |
defer f.Close() |
| 38 | 38 |
|
| 39 |
- out := []string{}
|
|
| 39 |
+ var out []string |
|
| 40 | 40 |
s := bufio.NewScanner(f) |
| 41 | 41 |
|
| 42 | 42 |
for s.Scan() {
|
| ... | ... |
@@ -27,7 +27,7 @@ import ( |
| 27 | 27 |
"github.com/docker/docker/pkg/mount" |
| 28 | 28 |
"github.com/docker/docker/pkg/parsers" |
| 29 | 29 |
"github.com/docker/docker/pkg/parsers/kernel" |
| 30 |
- units "github.com/docker/go-units" |
|
| 30 |
+ "github.com/docker/go-units" |
|
| 31 | 31 |
"github.com/opencontainers/selinux/go-selinux/label" |
| 32 | 32 |
"github.com/pkg/errors" |
| 33 | 33 |
"github.com/sirupsen/logrus" |
| ... | ... |
@@ -50,8 +50,8 @@ var ( |
| 50 | 50 |
lvmSetupConfigForce bool |
| 51 | 51 |
) |
| 52 | 52 |
|
| 53 |
-const deviceSetMetaFile string = "deviceset-metadata" |
|
| 54 |
-const transactionMetaFile string = "transaction-metadata" |
|
| 53 |
+const deviceSetMetaFile = "deviceset-metadata" |
|
| 54 |
+const transactionMetaFile = "transaction-metadata" |
|
| 55 | 55 |
|
| 56 | 56 |
type transaction struct {
|
| 57 | 57 |
OpenTransactionID uint64 `json:"open_transaction_id"` |
| ... | ... |
@@ -15,7 +15,7 @@ import ( |
| 15 | 15 |
"github.com/docker/docker/pkg/idtools" |
| 16 | 16 |
"github.com/docker/docker/pkg/locker" |
| 17 | 17 |
"github.com/docker/docker/pkg/mount" |
| 18 |
- units "github.com/docker/go-units" |
|
| 18 |
+ "github.com/docker/go-units" |
|
| 19 | 19 |
"github.com/pkg/errors" |
| 20 | 20 |
"github.com/sirupsen/logrus" |
| 21 | 21 |
"golang.org/x/sys/unix" |
| ... | ... |
@@ -15,7 +15,7 @@ import ( |
| 15 | 15 |
"github.com/docker/docker/daemon/graphdriver" |
| 16 | 16 |
"github.com/docker/docker/daemon/graphdriver/quota" |
| 17 | 17 |
"github.com/docker/docker/pkg/stringid" |
| 18 |
- units "github.com/docker/go-units" |
|
| 18 |
+ "github.com/docker/go-units" |
|
| 19 | 19 |
"github.com/gotestyourself/gotestyourself/assert" |
| 20 | 20 |
is "github.com/gotestyourself/gotestyourself/assert/cmp" |
| 21 | 21 |
"golang.org/x/sys/unix" |
| ... | ... |
@@ -148,7 +148,7 @@ func changeManyFiles(drv graphdriver.Driver, layer string, count int, seed int64 |
| 148 | 148 |
} |
| 149 | 149 |
defer drv.Put(layer) |
| 150 | 150 |
|
| 151 |
- changes := []archive.Change{}
|
|
| 151 |
+ var changes []archive.Change |
|
| 152 | 152 |
for i := 0; i < count; i += 100 {
|
| 153 | 153 |
archiveRoot := fmt.Sprintf("/directory-%d", i)
|
| 154 | 154 |
if err := root.MkdirAll(root.Join(root.Path(), archiveRoot), 0755); err != nil {
|
| ... | ... |
@@ -10,7 +10,7 @@ import ( |
| 10 | 10 |
"github.com/docker/docker/pkg/containerfs" |
| 11 | 11 |
"github.com/docker/docker/pkg/idtools" |
| 12 | 12 |
"github.com/docker/docker/pkg/system" |
| 13 |
- units "github.com/docker/go-units" |
|
| 13 |
+ "github.com/docker/go-units" |
|
| 14 | 14 |
"github.com/opencontainers/selinux/go-selinux/label" |
| 15 | 15 |
) |
| 16 | 16 |
|
| ... | ... |
@@ -17,7 +17,7 @@ import ( |
| 17 | 17 |
"github.com/docker/docker/pkg/idtools" |
| 18 | 18 |
"github.com/docker/docker/pkg/mount" |
| 19 | 19 |
"github.com/docker/docker/pkg/parsers" |
| 20 |
- zfs "github.com/mistifyio/go-zfs" |
|
| 20 |
+ "github.com/mistifyio/go-zfs" |
|
| 21 | 21 |
"github.com/opencontainers/selinux/go-selinux/label" |
| 22 | 22 |
"github.com/sirupsen/logrus" |
| 23 | 23 |
"golang.org/x/sys/unix" |
| ... | ... |
@@ -18,7 +18,7 @@ import ( |
| 18 | 18 |
type conflictType int |
| 19 | 19 |
|
| 20 | 20 |
const ( |
| 21 |
- conflictDependentChild conflictType = (1 << iota) |
|
| 21 |
+ conflictDependentChild conflictType = 1 << iota |
|
| 22 | 22 |
conflictRunningContainer |
| 23 | 23 |
conflictActiveReference |
| 24 | 24 |
conflictStoppedContainer |
| ... | ... |
@@ -126,7 +126,7 @@ func (i *ImageService) ImageDelete(imageRef string, force, prune bool) ([]types. |
| 126 | 126 |
} |
| 127 | 127 |
if !foundRepoTagRef {
|
| 128 | 128 |
// Remove canonical references from same repository |
| 129 |
- remainingRefs := []reference.Named{}
|
|
| 129 |
+ var remainingRefs []reference.Named |
|
| 130 | 130 |
for _, repoRef := range repoRefs {
|
| 131 | 131 |
if _, repoRefIsCanonical := repoRef.(reference.Canonical); repoRefIsCanonical && parsedRef.Name() == repoRef.Name() {
|
| 132 | 132 |
if _, err := i.removeImageRef(repoRef); err != nil {
|
| ... | ... |
@@ -37,7 +37,7 @@ func (a *pluginAdapter) Log(msg *Message) error {
|
| 37 | 37 |
|
| 38 | 38 |
a.buf.Line = msg.Line |
| 39 | 39 |
a.buf.TimeNano = msg.Timestamp.UnixNano() |
| 40 |
- a.buf.Partial = (msg.PLogMetaData != nil) |
|
| 40 |
+ a.buf.Partial = msg.PLogMetaData != nil |
|
| 41 | 41 |
a.buf.Source = msg.Source |
| 42 | 42 |
|
| 43 | 43 |
err := a.enc.Encode(&a.buf) |
| ... | ... |
@@ -1139,8 +1139,8 @@ func TestCollectBatchWithDuplicateTimestamps(t *testing.T) {
|
| 1139 | 1139 |
close(d) |
| 1140 | 1140 |
go stream.collectBatch(d) |
| 1141 | 1141 |
|
| 1142 |
+ var expectedEvents []*cloudwatchlogs.InputLogEvent |
|
| 1142 | 1143 |
times := maximumLogEventsPerPut |
| 1143 |
- expectedEvents := []*cloudwatchlogs.InputLogEvent{}
|
|
| 1144 | 1144 |
timestamp := time.Now() |
| 1145 | 1145 |
for i := 0; i < times; i++ {
|
| 1146 | 1146 |
line := fmt.Sprintf("%d", i)
|
| ... | ... |
@@ -1,13 +1,12 @@ |
| 1 | 1 |
package gcplogs // import "github.com/docker/docker/daemon/logger/gcplogs" |
| 2 | 2 |
|
| 3 | 3 |
import ( |
| 4 |
+ "context" |
|
| 4 | 5 |
"fmt" |
| 5 | 6 |
"sync" |
| 6 | 7 |
"sync/atomic" |
| 7 | 8 |
"time" |
| 8 | 9 |
|
| 9 |
- "context" |
|
| 10 |
- |
|
| 11 | 10 |
"github.com/docker/docker/daemon/logger" |
| 12 | 11 |
|
| 13 | 12 |
"cloud.google.com/go/compute/metadata" |
| ... | ... |
@@ -13,7 +13,7 @@ import ( |
| 13 | 13 |
"github.com/docker/docker/daemon/logger" |
| 14 | 14 |
"github.com/docker/docker/daemon/logger/jsonfilelog/jsonlog" |
| 15 | 15 |
"github.com/docker/docker/daemon/logger/loggerutils" |
| 16 |
- units "github.com/docker/go-units" |
|
| 16 |
+ "github.com/docker/go-units" |
|
| 17 | 17 |
"github.com/pkg/errors" |
| 18 | 18 |
"github.com/sirupsen/logrus" |
| 19 | 19 |
) |
| ... | ... |
@@ -205,7 +205,7 @@ func TestMultiReadSeekerCurAfterSet(t *testing.T) {
|
| 205 | 205 |
} |
| 206 | 206 |
|
| 207 | 207 |
func TestMultiReadSeekerSmallReads(t *testing.T) {
|
| 208 |
- readers := []io.ReadSeeker{}
|
|
| 208 |
+ var readers []io.ReadSeeker |
|
| 209 | 209 |
for i := 0; i < 10; i++ {
|
| 210 | 210 |
integer := make([]byte, 4) |
| 211 | 211 |
binary.BigEndian.PutUint32(integer, uint32(i)) |
| ... | ... |
@@ -10,8 +10,8 @@ import ( |
| 10 | 10 |
"github.com/docker/docker/pkg/plugingetter" |
| 11 | 11 |
"github.com/docker/docker/pkg/plugins" |
| 12 | 12 |
"github.com/docker/docker/plugin" |
| 13 |
- metrics "github.com/docker/go-metrics" |
|
| 14 |
- specs "github.com/opencontainers/runtime-spec/specs-go" |
|
| 13 |
+ "github.com/docker/go-metrics" |
|
| 14 |
+ "github.com/opencontainers/runtime-spec/specs-go" |
|
| 15 | 15 |
"github.com/pkg/errors" |
| 16 | 16 |
"github.com/sirupsen/logrus" |
| 17 | 17 |
"golang.org/x/sys/unix" |
| ... | ... |
@@ -23,7 +23,7 @@ import ( |
| 23 | 23 |
"github.com/opencontainers/runc/libcontainer/cgroups" |
| 24 | 24 |
"github.com/opencontainers/runc/libcontainer/devices" |
| 25 | 25 |
"github.com/opencontainers/runc/libcontainer/user" |
| 26 |
- specs "github.com/opencontainers/runtime-spec/specs-go" |
|
| 26 |
+ "github.com/opencontainers/runtime-spec/specs-go" |
|
| 27 | 27 |
"github.com/pkg/errors" |
| 28 | 28 |
"github.com/sirupsen/logrus" |
| 29 | 29 |
"golang.org/x/sys/unix" |
| ... | ... |
@@ -89,7 +89,7 @@ func TestDaemonReloadAllowNondistributableArtifacts(t *testing.T) {
|
| 89 | 89 |
t.Fatal(err) |
| 90 | 90 |
} |
| 91 | 91 |
|
| 92 |
- actual := []string{}
|
|
| 92 |
+ var actual []string |
|
| 93 | 93 |
serviceConfig := daemon.RegistryService.ServiceConfig() |
| 94 | 94 |
for _, value := range serviceConfig.AllowNondistributableArtifactsCIDRs {
|
| 95 | 95 |
actual = append(actual, value.String()) |
| ... | ... |
@@ -5,7 +5,7 @@ import ( |
| 5 | 5 |
|
| 6 | 6 |
"github.com/docker/docker/api/types/container" |
| 7 | 7 |
"github.com/docker/docker/libcontainerd" |
| 8 |
- specs "github.com/opencontainers/runtime-spec/specs-go" |
|
| 8 |
+ "github.com/opencontainers/runtime-spec/specs-go" |
|
| 9 | 9 |
) |
| 10 | 10 |
|
| 11 | 11 |
func toContainerdResources(resources container.Resources) *libcontainerd.Resources {
|
| ... | ... |
@@ -48,7 +48,7 @@ func TestContinueOnError_NonMirrorEndpoint(t *testing.T) {
|
| 48 | 48 |
} |
| 49 | 49 |
|
| 50 | 50 |
func TestContinueOnError_MirrorEndpoint(t *testing.T) {
|
| 51 |
- errs := []error{}
|
|
| 51 |
+ var errs []error |
|
| 52 | 52 |
errs = append(errs, alwaysContinue...) |
| 53 | 53 |
errs = append(errs, continueFromMirrorEndpoint...) |
| 54 | 54 |
for _, err := range errs {
|
| ... | ... |
@@ -30,7 +30,7 @@ import ( |
| 30 | 30 |
"github.com/docker/docker/pkg/system" |
| 31 | 31 |
refstore "github.com/docker/docker/reference" |
| 32 | 32 |
"github.com/docker/docker/registry" |
| 33 |
- digest "github.com/opencontainers/go-digest" |
|
| 33 |
+ "github.com/opencontainers/go-digest" |
|
| 34 | 34 |
specs "github.com/opencontainers/image-spec/specs-go/v1" |
| 35 | 35 |
"github.com/pkg/errors" |
| 36 | 36 |
"github.com/sirupsen/logrus" |
| ... | ... |
@@ -24,7 +24,7 @@ import ( |
| 24 | 24 |
"github.com/docker/docker/pkg/progress" |
| 25 | 25 |
"github.com/docker/docker/pkg/stringid" |
| 26 | 26 |
"github.com/docker/docker/registry" |
| 27 |
- digest "github.com/opencontainers/go-digest" |
|
| 27 |
+ "github.com/opencontainers/go-digest" |
|
| 28 | 28 |
"github.com/sirupsen/logrus" |
| 29 | 29 |
) |
| 30 | 30 |
|
| ... | ... |
@@ -6,12 +6,12 @@ package dockerversion // import "github.com/docker/docker/dockerversion" |
| 6 | 6 |
// Default build-time variable for library-import. |
| 7 | 7 |
// This file is overridden on build with build-time informations. |
| 8 | 8 |
const ( |
| 9 |
- GitCommit string = "library-import" |
|
| 10 |
- Version string = "library-import" |
|
| 11 |
- BuildTime string = "library-import" |
|
| 12 |
- IAmStatic string = "library-import" |
|
| 13 |
- ContainerdCommitID string = "library-import" |
|
| 14 |
- RuncCommitID string = "library-import" |
|
| 15 |
- InitCommitID string = "library-import" |
|
| 16 |
- PlatformName string = "" |
|
| 9 |
+ GitCommit = "library-import" |
|
| 10 |
+ Version = "library-import" |
|
| 11 |
+ BuildTime = "library-import" |
|
| 12 |
+ IAmStatic = "library-import" |
|
| 13 |
+ ContainerdCommitID = "library-import" |
|
| 14 |
+ RuncCommitID = "library-import" |
|
| 15 |
+ InitCommitID = "library-import" |
|
| 16 |
+ PlatformName = "" |
|
| 17 | 17 |
) |
| ... | ... |
@@ -8,7 +8,7 @@ import ( |
| 8 | 8 |
) |
| 9 | 9 |
|
| 10 | 10 |
func generateInput(inputLen int) []string {
|
| 11 |
- input := []string{}
|
|
| 11 |
+ var input []string |
|
| 12 | 12 |
for i := 0; i < inputLen; i++ {
|
| 13 | 13 |
input = append(input, fmt.Sprintf("s%d", i))
|
| 14 | 14 |
} |
| ... | ... |
@@ -21,7 +21,7 @@ func testChunkStrings(t *testing.T, inputLen, numChunks int) {
|
| 21 | 21 |
input := generateInput(inputLen) |
| 22 | 22 |
result := chunkStrings(input, numChunks) |
| 23 | 23 |
t.Logf("result has %d chunks", len(result))
|
| 24 |
- inputReconstructedFromResult := []string{}
|
|
| 24 |
+ var inputReconstructedFromResult []string |
|
| 25 | 25 |
for i, chunk := range result {
|
| 26 | 26 |
t.Logf("chunk %d has %d elements", i, len(chunk))
|
| 27 | 27 |
inputReconstructedFromResult = append(inputReconstructedFromResult, chunk...) |
| ... | ... |
@@ -23,7 +23,7 @@ import ( |
| 23 | 23 |
"github.com/docker/docker/pkg/stringid" |
| 24 | 24 |
"github.com/docker/docker/pkg/symlink" |
| 25 | 25 |
"github.com/docker/docker/pkg/system" |
| 26 |
- digest "github.com/opencontainers/go-digest" |
|
| 26 |
+ "github.com/opencontainers/go-digest" |
|
| 27 | 27 |
"github.com/sirupsen/logrus" |
| 28 | 28 |
) |
| 29 | 29 |
|
| ... | ... |
@@ -289,7 +289,7 @@ func isNetworkAvailable(c *check.C, name string) bool {
|
| 289 | 289 |
defer resp.Body.Close() |
| 290 | 290 |
c.Assert(resp.StatusCode, checker.Equals, http.StatusOK) |
| 291 | 291 |
|
| 292 |
- nJSON := []types.NetworkResource{}
|
|
| 292 |
+ var nJSON []types.NetworkResource |
|
| 293 | 293 |
err = json.NewDecoder(body).Decode(&nJSON) |
| 294 | 294 |
c.Assert(err, checker.IsNil) |
| 295 | 295 |
|
| ... | ... |
@@ -315,7 +315,7 @@ func getNetworkIDByName(c *check.C, name string) string {
|
| 315 | 315 |
c.Assert(resp.StatusCode, checker.Equals, http.StatusOK) |
| 316 | 316 |
c.Assert(err, checker.IsNil) |
| 317 | 317 |
|
| 318 |
- nJSON := []types.NetworkResource{}
|
|
| 318 |
+ var nJSON []types.NetworkResource |
|
| 319 | 319 |
err = json.NewDecoder(body).Decode(&nJSON) |
| 320 | 320 |
c.Assert(err, checker.IsNil) |
| 321 | 321 |
var res string |
| ... | ... |
@@ -27,7 +27,7 @@ import ( |
| 27 | 27 |
"github.com/docker/docker/pkg/archive" |
| 28 | 28 |
"github.com/go-check/check" |
| 29 | 29 |
"github.com/gotestyourself/gotestyourself/icmd" |
| 30 |
- digest "github.com/opencontainers/go-digest" |
|
| 30 |
+ "github.com/opencontainers/go-digest" |
|
| 31 | 31 |
) |
| 32 | 32 |
|
| 33 | 33 |
func (s *DockerSuite) TestBuildJSONEmptyRun(c *check.C) {
|
| ... | ... |
@@ -195,7 +195,7 @@ func (s *DockerSuite) TestBuildEnvironmentReplacementEnv(c *check.C) {
|
| 195 | 195 |
RUN [ "$foo5" = 'abc\def' ] |
| 196 | 196 |
`)) |
| 197 | 197 |
|
| 198 |
- envResult := []string{}
|
|
| 198 |
+ var envResult []string |
|
| 199 | 199 |
inspectFieldAndUnmarshall(c, name, "Config.Env", &envResult) |
| 200 | 200 |
found := false |
| 201 | 201 |
envCount := 0 |
| ... | ... |
@@ -4979,7 +4979,7 @@ func (s *DockerSuite) TestBuildLabelMultiple(c *check.C) {
|
| 4979 | 4979 |
"foo": "bar", |
| 4980 | 4980 |
"123": "456", |
| 4981 | 4981 |
} |
| 4982 |
- labelArgs := []string{}
|
|
| 4982 |
+ var labelArgs []string |
|
| 4983 | 4983 |
for k, v := range testLabels {
|
| 4984 | 4984 |
labelArgs = append(labelArgs, "--label", k+"="+v) |
| 4985 | 4985 |
} |
| ... | ... |
@@ -19,7 +19,7 @@ import ( |
| 19 | 19 |
"github.com/docker/docker/integration-cli/cli" |
| 20 | 20 |
"github.com/docker/docker/integration-cli/cli/build" |
| 21 | 21 |
"github.com/docker/docker/internal/test/fakecontext" |
| 22 |
- units "github.com/docker/go-units" |
|
| 22 |
+ "github.com/docker/go-units" |
|
| 23 | 23 |
"github.com/go-check/check" |
| 24 | 24 |
"github.com/gotestyourself/gotestyourself/icmd" |
| 25 | 25 |
) |
| ... | ... |
@@ -26,13 +26,13 @@ func (s *DockerSuite) TestCreateArgs(c *check.C) {
|
| 26 | 26 |
|
| 27 | 27 |
out, _ = dockerCmd(c, "inspect", cleanedContainerID) |
| 28 | 28 |
|
| 29 |
- containers := []struct {
|
|
| 29 |
+ var containers []struct {
|
|
| 30 | 30 |
ID string |
| 31 | 31 |
Created time.Time |
| 32 | 32 |
Path string |
| 33 | 33 |
Args []string |
| 34 | 34 |
Image string |
| 35 |
- }{}
|
|
| 35 |
+ } |
|
| 36 | 36 |
|
| 37 | 37 |
err := json.Unmarshal([]byte(out), &containers) |
| 38 | 38 |
c.Assert(err, check.IsNil, check.Commentf("Error inspecting the container: %s", err))
|
| ... | ... |
@@ -87,11 +87,11 @@ func (s *DockerSuite) TestCreateHostConfig(c *check.C) {
|
| 87 | 87 |
|
| 88 | 88 |
out, _ = dockerCmd(c, "inspect", cleanedContainerID) |
| 89 | 89 |
|
| 90 |
- containers := []struct {
|
|
| 90 |
+ var containers []struct {
|
|
| 91 | 91 |
HostConfig *struct {
|
| 92 | 92 |
PublishAllPorts bool |
| 93 | 93 |
} |
| 94 |
- }{}
|
|
| 94 |
+ } |
|
| 95 | 95 |
|
| 96 | 96 |
err := json.Unmarshal([]byte(out), &containers) |
| 97 | 97 |
c.Assert(err, check.IsNil, check.Commentf("Error inspecting the container: %s", err))
|
| ... | ... |
@@ -109,11 +109,11 @@ func (s *DockerSuite) TestCreateWithPortRange(c *check.C) {
|
| 109 | 109 |
|
| 110 | 110 |
out, _ = dockerCmd(c, "inspect", cleanedContainerID) |
| 111 | 111 |
|
| 112 |
- containers := []struct {
|
|
| 112 |
+ var containers []struct {
|
|
| 113 | 113 |
HostConfig *struct {
|
| 114 | 114 |
PortBindings map[nat.Port][]nat.PortBinding |
| 115 | 115 |
} |
| 116 |
- }{}
|
|
| 116 |
+ } |
|
| 117 | 117 |
err := json.Unmarshal([]byte(out), &containers) |
| 118 | 118 |
c.Assert(err, check.IsNil, check.Commentf("Error inspecting the container: %s", err))
|
| 119 | 119 |
c.Assert(containers, checker.HasLen, 1) |
| ... | ... |
@@ -138,11 +138,11 @@ func (s *DockerSuite) TestCreateWithLargePortRange(c *check.C) {
|
| 138 | 138 |
|
| 139 | 139 |
out, _ = dockerCmd(c, "inspect", cleanedContainerID) |
| 140 | 140 |
|
| 141 |
- containers := []struct {
|
|
| 141 |
+ var containers []struct {
|
|
| 142 | 142 |
HostConfig *struct {
|
| 143 | 143 |
PortBindings map[nat.Port][]nat.PortBinding |
| 144 | 144 |
} |
| 145 |
- }{}
|
|
| 145 |
+ } |
|
| 146 | 146 |
|
| 147 | 147 |
err := json.Unmarshal([]byte(out), &containers) |
| 148 | 148 |
c.Assert(err, check.IsNil, check.Commentf("Error inspecting the container: %s", err))
|
| ... | ... |
@@ -6,6 +6,8 @@ import ( |
| 6 | 6 |
"bufio" |
| 7 | 7 |
"bytes" |
| 8 | 8 |
"context" |
| 9 |
+ "crypto/tls" |
|
| 10 |
+ "crypto/x509" |
|
| 9 | 11 |
"encoding/json" |
| 10 | 12 |
"fmt" |
| 11 | 13 |
"io" |
| ... | ... |
@@ -21,9 +23,6 @@ import ( |
| 21 | 21 |
"sync" |
| 22 | 22 |
"time" |
| 23 | 23 |
|
| 24 |
- "crypto/tls" |
|
| 25 |
- "crypto/x509" |
|
| 26 |
- |
|
| 27 | 24 |
"github.com/cloudflare/cfssl/helpers" |
| 28 | 25 |
"github.com/docker/docker/api" |
| 29 | 26 |
"github.com/docker/docker/api/types" |
| ... | ... |
@@ -36,7 +35,7 @@ import ( |
| 36 | 36 |
testdaemon "github.com/docker/docker/internal/test/daemon" |
| 37 | 37 |
"github.com/docker/docker/opts" |
| 38 | 38 |
"github.com/docker/docker/pkg/mount" |
| 39 |
- units "github.com/docker/go-units" |
|
| 39 |
+ "github.com/docker/go-units" |
|
| 40 | 40 |
"github.com/docker/libnetwork/iptables" |
| 41 | 41 |
"github.com/docker/libtrust" |
| 42 | 42 |
"github.com/go-check/check" |
| ... | ... |
@@ -1828,8 +1827,8 @@ func (s *DockerDaemonSuite) TestDaemonNoSpaceLeftOnDeviceError(c *check.C) {
|
| 1828 | 1828 |
func (s *DockerDaemonSuite) TestDaemonRestartContainerLinksRestart(c *check.C) {
|
| 1829 | 1829 |
s.d.StartWithBusybox(c) |
| 1830 | 1830 |
|
| 1831 |
- parent1Args := []string{}
|
|
| 1832 |
- parent2Args := []string{}
|
|
| 1831 |
+ var parent1Args []string |
|
| 1832 |
+ var parent2Args []string |
|
| 1833 | 1833 |
wg := sync.WaitGroup{}
|
| 1834 | 1834 |
maxChildren := 10 |
| 1835 | 1835 |
chErr := make(chan error, maxChildren) |
| ... | ... |
@@ -262,7 +262,7 @@ func (s *DockerSuite) TestExecCgroup(c *check.C) {
|
| 262 | 262 |
|
| 263 | 263 |
var wg sync.WaitGroup |
| 264 | 264 |
var mu sync.Mutex |
| 265 |
- execCgroups := []sort.StringSlice{}
|
|
| 265 |
+ var execCgroups []sort.StringSlice |
|
| 266 | 266 |
errChan := make(chan error) |
| 267 | 267 |
// exec a few times concurrently to get consistent failure |
| 268 | 268 |
for i := 0; i < 5; i++ {
|
| ... | ... |
@@ -273,7 +273,7 @@ func assertNwList(c *check.C, out string, expectNws []string) {
|
| 273 | 273 |
|
| 274 | 274 |
func getNwResource(c *check.C, name string) *types.NetworkResource {
|
| 275 | 275 |
out, _ := dockerCmd(c, "network", "inspect", name) |
| 276 |
- nr := []types.NetworkResource{}
|
|
| 276 |
+ var nr []types.NetworkResource |
|
| 277 | 277 |
err := json.Unmarshal([]byte(out), &nr) |
| 278 | 278 |
c.Assert(err, check.IsNil) |
| 279 | 279 |
return &nr[0] |
| ... | ... |
@@ -426,7 +426,7 @@ func (s *DockerSuite) TestDockerNetworkDeleteMultiple(c *check.C) {
|
| 426 | 426 |
|
| 427 | 427 |
func (s *DockerSuite) TestDockerNetworkInspect(c *check.C) {
|
| 428 | 428 |
out, _ := dockerCmd(c, "network", "inspect", "host") |
| 429 |
- networkResources := []types.NetworkResource{}
|
|
| 429 |
+ var networkResources []types.NetworkResource |
|
| 430 | 430 |
err := json.Unmarshal([]byte(out), &networkResources) |
| 431 | 431 |
c.Assert(err, check.IsNil) |
| 432 | 432 |
c.Assert(networkResources, checker.HasLen, 1) |
| ... | ... |
@@ -450,7 +450,7 @@ func (s *DockerSuite) TestDockerInspectMultipleNetwork(c *check.C) {
|
| 450 | 450 |
result := dockerCmdWithResult("network", "inspect", "host", "none")
|
| 451 | 451 |
result.Assert(c, icmd.Success) |
| 452 | 452 |
|
| 453 |
- networkResources := []types.NetworkResource{}
|
|
| 453 |
+ var networkResources []types.NetworkResource |
|
| 454 | 454 |
err := json.Unmarshal([]byte(result.Stdout()), &networkResources) |
| 455 | 455 |
c.Assert(err, check.IsNil) |
| 456 | 456 |
c.Assert(networkResources, checker.HasLen, 2) |
| ... | ... |
@@ -466,7 +466,7 @@ func (s *DockerSuite) TestDockerInspectMultipleNetworksIncludingNonexistent(c *c |
| 466 | 466 |
Out: "host", |
| 467 | 467 |
}) |
| 468 | 468 |
|
| 469 |
- networkResources := []types.NetworkResource{}
|
|
| 469 |
+ var networkResources []types.NetworkResource |
|
| 470 | 470 |
err := json.Unmarshal([]byte(result.Stdout()), &networkResources) |
| 471 | 471 |
c.Assert(err, check.IsNil) |
| 472 | 472 |
c.Assert(networkResources, checker.HasLen, 1) |
| ... | ... |
@@ -512,7 +512,7 @@ func (s *DockerSuite) TestDockerInspectNetworkWithContainerName(c *check.C) {
|
| 512 | 512 |
}() |
| 513 | 513 |
|
| 514 | 514 |
out, _ = dockerCmd(c, "network", "inspect", "brNetForInspect") |
| 515 |
- networkResources := []types.NetworkResource{}
|
|
| 515 |
+ var networkResources []types.NetworkResource |
|
| 516 | 516 |
err := json.Unmarshal([]byte(out), &networkResources) |
| 517 | 517 |
c.Assert(err, check.IsNil) |
| 518 | 518 |
c.Assert(networkResources, checker.HasLen, 1) |
| ... | ... |
@@ -526,7 +526,7 @@ func (s *DockerSuite) TestDockerInspectNetworkWithContainerName(c *check.C) {
|
| 526 | 526 |
|
| 527 | 527 |
// check whether network inspect works properly |
| 528 | 528 |
out, _ = dockerCmd(c, "network", "inspect", "brNetForInspect") |
| 529 |
- newNetRes := []types.NetworkResource{}
|
|
| 529 |
+ var newNetRes []types.NetworkResource |
|
| 530 | 530 |
err = json.Unmarshal([]byte(out), &newNetRes) |
| 531 | 531 |
c.Assert(err, check.IsNil) |
| 532 | 532 |
c.Assert(newNetRes, checker.HasLen, 1) |
| ... | ... |
@@ -172,7 +172,7 @@ func (s *DockerSuite) TestPsListContainersSize(c *check.C) {
|
| 172 | 172 |
idIndex := strings.Index(lines[0], "CONTAINER ID") |
| 173 | 173 |
foundID := lines[1][idIndex : idIndex+12] |
| 174 | 174 |
c.Assert(foundID, checker.Equals, id[:12], check.Commentf("Expected id %s, got %s", id[:12], foundID))
|
| 175 |
- expectedSize := fmt.Sprintf("%dB", (2 + baseBytes))
|
|
| 175 |
+ expectedSize := fmt.Sprintf("%dB", 2+baseBytes)
|
|
| 176 | 176 |
foundSize := lines[1][sizeIndex:] |
| 177 | 177 |
c.Assert(foundSize, checker.Contains, expectedSize, check.Commentf("Expected size %q, got %q", expectedSize, foundSize))
|
| 178 | 178 |
} |
| ... | ... |
@@ -377,7 +377,7 @@ func (s *DockerSuite) TestPsListContainersFilterAncestorImage(c *check.C) {
|
| 377 | 377 |
} |
| 378 | 378 |
|
| 379 | 379 |
func checkPsAncestorFilterOutput(c *check.C, out string, filterName string, expectedIDs []string) {
|
| 380 |
- actualIDs := []string{}
|
|
| 380 |
+ var actualIDs []string |
|
| 381 | 381 |
if out != "" {
|
| 382 | 382 |
actualIDs = strings.Split(out[:len(out)-1], "\n") |
| 383 | 383 |
} |
| ... | ... |
@@ -27,7 +27,7 @@ import ( |
| 27 | 27 |
func testPullImageWithAliases(c *check.C) {
|
| 28 | 28 |
repoName := fmt.Sprintf("%v/dockercli/busybox", privateRegistryURL)
|
| 29 | 29 |
|
| 30 |
- repos := []string{}
|
|
| 30 |
+ var repos []string |
|
| 31 | 31 |
for _, tag := range []string{"recent", "fresh"} {
|
| 32 | 32 |
repos = append(repos, fmt.Sprintf("%v:%v", repoName, tag))
|
| 33 | 33 |
} |
| ... | ... |
@@ -63,7 +63,7 @@ func (s *DockerSchema1RegistrySuite) TestPullImageWithAliases(c *check.C) {
|
| 63 | 63 |
func testConcurrentPullWholeRepo(c *check.C) {
|
| 64 | 64 |
repoName := fmt.Sprintf("%v/dockercli/busybox", privateRegistryURL)
|
| 65 | 65 |
|
| 66 |
- repos := []string{}
|
|
| 66 |
+ var repos []string |
|
| 67 | 67 |
for _, tag := range []string{"recent", "fresh", "todays"} {
|
| 68 | 68 |
repo := fmt.Sprintf("%v:%v", repoName, tag)
|
| 69 | 69 |
buildImageSuccessfully(c, repo, build.WithDockerfile(fmt.Sprintf(` |
| ... | ... |
@@ -151,7 +151,7 @@ func (s *DockerSchema1RegistrySuite) testConcurrentFailingPull(c *check.C) {
|
| 151 | 151 |
func testConcurrentPullMultipleTags(c *check.C) {
|
| 152 | 152 |
repoName := fmt.Sprintf("%v/dockercli/busybox", privateRegistryURL)
|
| 153 | 153 |
|
| 154 |
- repos := []string{}
|
|
| 154 |
+ var repos []string |
|
| 155 | 155 |
for _, tag := range []string{"recent", "fresh", "todays"} {
|
| 156 | 156 |
repo := fmt.Sprintf("%v:%v", repoName, tag)
|
| 157 | 157 |
buildImageSuccessfully(c, repo, build.WithDockerfile(fmt.Sprintf(` |
| ... | ... |
@@ -155,7 +155,7 @@ func (s *DockerSchema1RegistrySuite) TestPushEmptyLayer(c *check.C) {
|
| 155 | 155 |
func testConcurrentPush(c *check.C) {
|
| 156 | 156 |
repoName := fmt.Sprintf("%v/dockercli/busybox", privateRegistryURL)
|
| 157 | 157 |
|
| 158 |
- repos := []string{}
|
|
| 158 |
+ var repos []string |
|
| 159 | 159 |
for _, tag := range []string{"push1", "push2", "push3"} {
|
| 160 | 160 |
repo := fmt.Sprintf("%v:%v", repoName, tag)
|
| 161 | 161 |
buildImageSuccessfully(c, repo, build.WithDockerfile(fmt.Sprintf(` |
| ... | ... |
@@ -19,7 +19,7 @@ import ( |
| 19 | 19 |
"github.com/docker/docker/integration-cli/cli/build" |
| 20 | 20 |
"github.com/go-check/check" |
| 21 | 21 |
"github.com/gotestyourself/gotestyourself/icmd" |
| 22 |
- digest "github.com/opencontainers/go-digest" |
|
| 22 |
+ "github.com/opencontainers/go-digest" |
|
| 23 | 23 |
) |
| 24 | 24 |
|
| 25 | 25 |
// save a repo using gz compression and try to load it using stdout |
| ... | ... |
@@ -100,10 +100,10 @@ func (s *DockerSuite) TestSaveCheckTimes(c *check.C) {
|
| 100 | 100 |
testRequires(c, DaemonIsLinux) |
| 101 | 101 |
repoName := "busybox:latest" |
| 102 | 102 |
out, _ := dockerCmd(c, "inspect", repoName) |
| 103 |
- data := []struct {
|
|
| 103 |
+ var data []struct {
|
|
| 104 | 104 |
ID string |
| 105 | 105 |
Created time.Time |
| 106 |
- }{}
|
|
| 106 |
+ } |
|
| 107 | 107 |
err := json.Unmarshal([]byte(out), &data) |
| 108 | 108 |
c.Assert(err, checker.IsNil, check.Commentf("failed to marshal from %q: err %v", repoName, err))
|
| 109 | 109 |
c.Assert(len(data), checker.Not(checker.Equals), 0, check.Commentf("failed to marshal the data from %q", repoName))
|
| ... | ... |
@@ -16,7 +16,7 @@ import ( |
| 16 | 16 |
func (s *DockerSuite) TestClientSetsTLSServerName(c *check.C) {
|
| 17 | 17 |
c.Skip("Flakey test")
|
| 18 | 18 |
// there may be more than one hit to the server for each registry request |
| 19 |
- serverNameReceived := []string{}
|
|
| 19 |
+ var serverNameReceived []string |
|
| 20 | 20 |
var serverName string |
| 21 | 21 |
|
| 22 | 22 |
virtualHostServer := httptest.NewTLSServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
| ... | ... |
@@ -119,7 +119,7 @@ type elementListOptions struct {
|
| 119 | 119 |
} |
| 120 | 120 |
|
| 121 | 121 |
func existingElements(c *check.C, opts elementListOptions) []string {
|
| 122 |
- args := []string{}
|
|
| 122 |
+ var args []string |
|
| 123 | 123 |
switch opts.element {
|
| 124 | 124 |
case "container": |
| 125 | 125 |
args = append(args, "ps", "-a") |
| ... | ... |
@@ -136,7 +136,7 @@ func existingElements(c *check.C, opts elementListOptions) []string {
|
| 136 | 136 |
args = append(args, "--format", opts.format) |
| 137 | 137 |
} |
| 138 | 138 |
out, _ := dockerCmd(c, args...) |
| 139 |
- lines := []string{}
|
|
| 139 |
+ var lines []string |
|
| 140 | 140 |
for _, l := range strings.Split(out, "\n") {
|
| 141 | 141 |
if l != "" {
|
| 142 | 142 |
lines = append(lines, l) |
| ... | ... |
@@ -46,7 +46,7 @@ func TestConfigList(t *testing.T) {
|
| 46 | 46 |
config1ID := createConfig(ctx, t, client, testName1, []byte("TESTINGDATA1"), map[string]string{"type": "production"})
|
| 47 | 47 |
|
| 48 | 48 |
names := func(entries []swarmtypes.Config) []string {
|
| 49 |
- values := []string{}
|
|
| 49 |
+ var values []string |
|
| 50 | 50 |
for _, entry := range entries {
|
| 51 | 51 |
values = append(values, entry.Spec.Name) |
| 52 | 52 |
} |
| ... | ... |
@@ -51,7 +51,7 @@ func TestPause(t *testing.T) {
|
| 51 | 51 |
} |
| 52 | 52 |
|
| 53 | 53 |
func TestPauseFailsOnWindowsServerContainers(t *testing.T) {
|
| 54 |
- skip.If(t, (testEnv.DaemonInfo.OSType != "windows" || testEnv.DaemonInfo.Isolation != "process")) |
|
| 54 |
+ skip.If(t, testEnv.DaemonInfo.OSType != "windows" || testEnv.DaemonInfo.Isolation != "process") |
|
| 55 | 55 |
|
| 56 | 56 |
defer setupTest(t)() |
| 57 | 57 |
client := request.NewAPIClient(t) |
| ... | ... |
@@ -85,7 +85,7 @@ func TestPauseStopPausedContainer(t *testing.T) {
|
| 85 | 85 |
} |
| 86 | 86 |
|
| 87 | 87 |
func getEventActions(t *testing.T, messages <-chan events.Message, errs <-chan error) []string {
|
| 88 |
- actions := []string{}
|
|
| 88 |
+ var actions []string |
|
| 89 | 89 |
for {
|
| 90 | 90 |
select {
|
| 91 | 91 |
case err := <-errs: |
| ... | ... |
@@ -22,7 +22,7 @@ func TestPsFilter(t *testing.T) {
|
| 22 | 22 |
next := container.Create(t, ctx, client) |
| 23 | 23 |
|
| 24 | 24 |
containerIDs := func(containers []types.Container) []string {
|
| 25 |
- entries := []string{}
|
|
| 25 |
+ var entries []string |
|
| 26 | 26 |
for _, container := range containers {
|
| 27 | 27 |
entries = append(entries, container.ID) |
| 28 | 28 |
} |
| ... | ... |
@@ -173,8 +173,8 @@ func TestDaemonRestartWithExistingNetworkWithDefaultPoolRange(t *testing.T) {
|
| 173 | 173 |
out1, err := cli.NetworkInspect(context.Background(), name, types.NetworkInspectOptions{})
|
| 174 | 174 |
assert.NilError(t, err) |
| 175 | 175 |
|
| 176 |
- assert.Check(t, (out1.IPAM.Config[0].Subnet != networkip)) |
|
| 177 |
- assert.Check(t, (out1.IPAM.Config[0].Subnet != networkip2)) |
|
| 176 |
+ assert.Check(t, out1.IPAM.Config[0].Subnet != networkip) |
|
| 177 |
+ assert.Check(t, out1.IPAM.Config[0].Subnet != networkip2) |
|
| 178 | 178 |
delInterface(t, defaultNetworkBridge) |
| 179 | 179 |
} |
| 180 | 180 |
|
| ... | ... |
@@ -63,7 +63,7 @@ func TestSecretList(t *testing.T) {
|
| 63 | 63 |
secret1ID := createSecret(ctx, t, client, testName1, []byte("TESTINGDATA1"), map[string]string{"type": "production"})
|
| 64 | 64 |
|
| 65 | 65 |
names := func(entries []swarmtypes.Secret) []string {
|
| 66 |
- values := []string{}
|
|
| 66 |
+ var values []string |
|
| 67 | 67 |
for _, entry := range entries {
|
| 68 | 68 |
values = append(values, entry.Spec.Name) |
| 69 | 69 |
} |
| ... | ... |
@@ -77,7 +77,7 @@ func getExistingContainers(t assert.TestingT, testEnv *Execution) []string {
|
| 77 | 77 |
}) |
| 78 | 78 |
assert.NilError(t, err, "failed to list containers") |
| 79 | 79 |
|
| 80 |
- containers := []string{}
|
|
| 80 |
+ var containers []string |
|
| 81 | 81 |
for _, container := range containerList {
|
| 82 | 82 |
containers = append(containers, container.ID) |
| 83 | 83 |
} |
| ... | ... |
@@ -121,7 +121,7 @@ func getExistingImages(t assert.TestingT, testEnv *Execution) []string {
|
| 121 | 121 |
}) |
| 122 | 122 |
assert.NilError(t, err, "failed to list images") |
| 123 | 123 |
|
| 124 |
- images := []string{}
|
|
| 124 |
+ var images []string |
|
| 125 | 125 |
for _, image := range imageList {
|
| 126 | 126 |
images = append(images, tagsFromImageSummary(image)...) |
| 127 | 127 |
} |
| ... | ... |
@@ -129,7 +129,7 @@ func getExistingImages(t assert.TestingT, testEnv *Execution) []string {
|
| 129 | 129 |
} |
| 130 | 130 |
|
| 131 | 131 |
func tagsFromImageSummary(image types.ImageSummary) []string {
|
| 132 |
- result := []string{}
|
|
| 132 |
+ var result []string |
|
| 133 | 133 |
for _, tag := range image.RepoTags {
|
| 134 | 134 |
if tag != "<none>:<none>" {
|
| 135 | 135 |
result = append(result, tag) |
| ... | ... |
@@ -172,7 +172,7 @@ func getExistingNetworks(t assert.TestingT, testEnv *Execution) []string {
|
| 172 | 172 |
networkList, err := client.NetworkList(context.Background(), types.NetworkListOptions{})
|
| 173 | 173 |
assert.NilError(t, err, "failed to list networks") |
| 174 | 174 |
|
| 175 |
- networks := []string{}
|
|
| 175 |
+ var networks []string |
|
| 176 | 176 |
for _, network := range networkList {
|
| 177 | 177 |
networks = append(networks, network.ID) |
| 178 | 178 |
} |
| ... | ... |
@@ -211,7 +211,7 @@ func getExistingPlugins(t assert.TestingT, testEnv *Execution) []string {
|
| 211 | 211 |
} |
| 212 | 212 |
assert.NilError(t, err, "failed to list plugins") |
| 213 | 213 |
|
| 214 |
- plugins := []string{}
|
|
| 214 |
+ var plugins []string |
|
| 215 | 215 |
for _, plugin := range pluginList {
|
| 216 | 216 |
plugins = append(plugins, plugin.Name) |
| 217 | 217 |
} |
| ... | ... |
@@ -246,7 +246,7 @@ func getExistingVolumes(t assert.TestingT, testEnv *Execution) []string {
|
| 246 | 246 |
volumeList, err := client.VolumeList(context.Background(), filters.Args{})
|
| 247 | 247 |
assert.NilError(t, err, "failed to list volumes") |
| 248 | 248 |
|
| 249 |
- volumes := []string{}
|
|
| 249 |
+ var volumes []string |
|
| 250 | 250 |
for _, volume := range volumeList.Volumes {
|
| 251 | 251 |
volumes = append(volumes, volume.Name) |
| 252 | 252 |
} |
| ... | ... |
@@ -10,7 +10,7 @@ import ( |
| 10 | 10 |
"github.com/containerd/containerd" |
| 11 | 11 |
"github.com/containerd/containerd/cio" |
| 12 | 12 |
"github.com/docker/docker/pkg/idtools" |
| 13 |
- specs "github.com/opencontainers/runtime-spec/specs-go" |
|
| 13 |
+ "github.com/opencontainers/runtime-spec/specs-go" |
|
| 14 | 14 |
"github.com/sirupsen/logrus" |
| 15 | 15 |
) |
| 16 | 16 |
|
| ... | ... |
@@ -1,6 +1,7 @@ |
| 1 | 1 |
package v1 // import "github.com/docker/docker/migrate/v1" |
| 2 | 2 |
|
| 3 | 3 |
import ( |
| 4 |
+ "encoding/json" |
|
| 4 | 5 |
"errors" |
| 5 | 6 |
"fmt" |
| 6 | 7 |
"io/ioutil" |
| ... | ... |
@@ -11,8 +12,6 @@ import ( |
| 11 | 11 |
"sync" |
| 12 | 12 |
"time" |
| 13 | 13 |
|
| 14 |
- "encoding/json" |
|
| 15 |
- |
|
| 16 | 14 |
"github.com/docker/distribution/reference" |
| 17 | 15 |
"github.com/docker/docker/distribution/metadata" |
| 18 | 16 |
"github.com/docker/docker/image" |
| ... | ... |
@@ -8,7 +8,7 @@ import ( |
| 8 | 8 |
|
| 9 | 9 |
"github.com/opencontainers/runc/libcontainer/configs" |
| 10 | 10 |
"github.com/opencontainers/runc/libcontainer/devices" |
| 11 |
- specs "github.com/opencontainers/runtime-spec/specs-go" |
|
| 11 |
+ "github.com/opencontainers/runtime-spec/specs-go" |
|
| 12 | 12 |
) |
| 13 | 13 |
|
| 14 | 14 |
// Device transforms a libcontainer configs.Device to a specs.LinuxDevice object. |
| ... | ... |
@@ -1,6 +1,6 @@ |
| 1 | 1 |
package oci // import "github.com/docker/docker/oci" |
| 2 | 2 |
|
| 3 |
-import specs "github.com/opencontainers/runtime-spec/specs-go" |
|
| 3 |
+import "github.com/opencontainers/runtime-spec/specs-go" |
|
| 4 | 4 |
|
| 5 | 5 |
// RemoveNamespace removes the `nsType` namespace from OCI spec `s` |
| 6 | 6 |
func RemoveNamespace(s *specs.Spec, nsType specs.LinuxNamespaceType) {
|
| ... | ... |
@@ -65,7 +65,7 @@ func (p *PoolsOpt) Type() string {
|
| 65 | 65 |
|
| 66 | 66 |
// String returns a string repr of this option |
| 67 | 67 |
func (p *PoolsOpt) String() string {
|
| 68 |
- pools := []string{}
|
|
| 68 |
+ var pools []string |
|
| 69 | 69 |
for _, pool := range p.values {
|
| 70 | 70 |
repr := fmt.Sprintf("%s %d", pool.Base, pool.Size)
|
| 71 | 71 |
pools = append(pools, repr) |
| ... | ... |
@@ -7,7 +7,7 @@ import ( |
| 7 | 7 |
"regexp" |
| 8 | 8 |
"strings" |
| 9 | 9 |
|
| 10 |
- units "github.com/docker/go-units" |
|
| 10 |
+ "github.com/docker/go-units" |
|
| 11 | 11 |
) |
| 12 | 12 |
|
| 13 | 13 |
var ( |
| ... | ... |
@@ -52,7 +52,7 @@ func (opts *ListOpts) Set(value string) error {
|
| 52 | 52 |
} |
| 53 | 53 |
value = v |
| 54 | 54 |
} |
| 55 |
- (*opts.values) = append((*opts.values), value) |
|
| 55 |
+ *opts.values = append(*opts.values, value) |
|
| 56 | 56 |
return nil |
| 57 | 57 |
} |
| 58 | 58 |
|
| ... | ... |
@@ -60,7 +60,7 @@ func (opts *ListOpts) Set(value string) error {
|
| 60 | 60 |
func (opts *ListOpts) Delete(key string) {
|
| 61 | 61 |
for i, k := range *opts.values {
|
| 62 | 62 |
if k == key {
|
| 63 |
- (*opts.values) = append((*opts.values)[:i], (*opts.values)[i+1:]...) |
|
| 63 |
+ *opts.values = append((*opts.values)[:i], (*opts.values)[i+1:]...) |
|
| 64 | 64 |
return |
| 65 | 65 |
} |
| 66 | 66 |
} |
| ... | ... |
@@ -78,7 +78,7 @@ func (opts *ListOpts) GetMap() map[string]struct{} {
|
| 78 | 78 |
|
| 79 | 79 |
// GetAll returns the values of slice. |
| 80 | 80 |
func (opts *ListOpts) GetAll() []string {
|
| 81 |
- return (*opts.values) |
|
| 81 |
+ return *opts.values |
|
| 82 | 82 |
} |
| 83 | 83 |
|
| 84 | 84 |
// GetAllOrEmpty returns the values of the slice |
| ... | ... |
@@ -103,7 +103,7 @@ func (opts *ListOpts) Get(key string) bool {
|
| 103 | 103 |
|
| 104 | 104 |
// Len returns the amount of element in the slice. |
| 105 | 105 |
func (opts *ListOpts) Len() int {
|
| 106 |
- return len((*opts.values)) |
|
| 106 |
+ return len(*opts.values) |
|
| 107 | 107 |
} |
| 108 | 108 |
|
| 109 | 109 |
// 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 }
|
| 112 | 112 |
|
| 113 | 113 |
func walkHeaders(r io.Reader) ([]tar.Header, error) {
|
| 114 | 114 |
t := tar.NewReader(r) |
| 115 |
- headers := []tar.Header{}
|
|
| 115 |
+ var headers []tar.Header |
|
| 116 | 116 |
for {
|
| 117 | 117 |
hdr, err := t.Next() |
| 118 | 118 |
if err != nil {
|
| ... | ... |
@@ -216,7 +216,7 @@ func dmGetNextTargetFct(task *cdmTask, next unsafe.Pointer, start, length *uint6 |
| 216 | 216 |
} |
| 217 | 217 |
|
| 218 | 218 |
func dmUdevSetSyncSupportFct(syncWithUdev int) {
|
| 219 |
- (C.dm_udev_set_sync_support(C.int(syncWithUdev))) |
|
| 219 |
+ C.dm_udev_set_sync_support(C.int(syncWithUdev)) |
|
| 220 | 220 |
} |
| 221 | 221 |
|
| 222 | 222 |
func dmUdevGetSyncSupportFct() int {
|
| ... | ... |
@@ -30,8 +30,8 @@ func (e ranges) Swap(i, j int) { e[i], e[j] = e[j], e[i] }
|
| 30 | 30 |
func (e ranges) Less(i, j int) bool { return e[i].Start < e[j].Start }
|
| 31 | 31 |
|
| 32 | 32 |
const ( |
| 33 |
- subuidFileName string = "/etc/subuid" |
|
| 34 |
- subgidFileName string = "/etc/subgid" |
|
| 33 |
+ subuidFileName = "/etc/subuid" |
|
| 34 |
+ subgidFileName = "/etc/subgid" |
|
| 35 | 35 |
) |
| 36 | 36 |
|
| 37 | 37 |
// MkdirAllAndChown creates a directory (include any along the path) and then modifies |
| ... | ... |
@@ -8,9 +8,9 @@ import ( |
| 8 | 8 |
"strings" |
| 9 | 9 |
"time" |
| 10 | 10 |
|
| 11 |
- gotty "github.com/Nvveen/Gotty" |
|
| 11 |
+ "github.com/Nvveen/Gotty" |
|
| 12 | 12 |
"github.com/docker/docker/pkg/term" |
| 13 |
- units "github.com/docker/go-units" |
|
| 13 |
+ "github.com/docker/go-units" |
|
| 14 | 14 |
) |
| 15 | 15 |
|
| 16 | 16 |
// RFC3339NanoFixed is time.RFC3339Nano with nanoseconds padded using zeros to |
| ... | ... |
@@ -20,7 +20,7 @@ func TestSendToOneSub(t *testing.T) {
|
| 20 | 20 |
|
| 21 | 21 |
func TestSendToMultipleSubs(t *testing.T) {
|
| 22 | 22 |
p := NewPublisher(100*time.Millisecond, 10) |
| 23 |
- subs := []chan interface{}{}
|
|
| 23 |
+ var subs []chan interface{}
|
|
| 24 | 24 |
subs = append(subs, p.Subscribe(), p.Subscribe(), p.Subscribe()) |
| 25 | 25 |
|
| 26 | 26 |
p.Publish("hi")
|
| ... | ... |
@@ -52,7 +52,7 @@ func TestEvictOneSub(t *testing.T) {
|
| 52 | 52 |
|
| 53 | 53 |
func TestClosePublisher(t *testing.T) {
|
| 54 | 54 |
p := NewPublisher(100*time.Millisecond, 10) |
| 55 |
- subs := []chan interface{}{}
|
|
| 55 |
+ var subs []chan interface{}
|
|
| 56 | 56 |
subs = append(subs, p.Subscribe(), p.Subscribe(), p.Subscribe()) |
| 57 | 57 |
p.Close() |
| 58 | 58 |
|
| ... | ... |
@@ -99,7 +99,7 @@ func newTestSubscriber(p *Publisher) *testSubscriber {
|
| 99 | 99 |
// for testing with -race |
| 100 | 100 |
func TestPubSubRace(t *testing.T) {
|
| 101 | 101 |
p := NewPublisher(0, 1024) |
| 102 |
- var subs [](*testSubscriber) |
|
| 102 |
+ var subs []*testSubscriber |
|
| 103 | 103 |
for j := 0; j < 50; j++ {
|
| 104 | 104 |
subs = append(subs, newTestSubscriber(p)) |
| 105 | 105 |
} |
| ... | ... |
@@ -120,7 +120,7 @@ func BenchmarkPubSub(b *testing.B) {
|
| 120 | 120 |
for i := 0; i < b.N; i++ {
|
| 121 | 121 |
b.StopTimer() |
| 122 | 122 |
p := NewPublisher(0, 1024) |
| 123 |
- var subs [](*testSubscriber) |
|
| 123 |
+ var subs []*testSubscriber |
|
| 124 | 124 |
for j := 0; j < 50; j++ {
|
| 125 | 125 |
subs = append(subs, newTestSubscriber(p)) |
| 126 | 126 |
} |
| ... | ... |
@@ -13,7 +13,7 @@ import ( |
| 13 | 13 |
|
| 14 | 14 |
// CatchAll catches all signals and relays them to the specified channel. |
| 15 | 15 |
func CatchAll(sigc chan os.Signal) {
|
| 16 |
- handledSigs := []os.Signal{}
|
|
| 16 |
+ var handledSigs []os.Signal |
|
| 17 | 17 |
for _, s := range SignalMap {
|
| 18 | 18 |
handledSigs = append(handledSigs, s) |
| 19 | 19 |
} |
| ... | ... |
@@ -10,7 +10,7 @@ import ( |
| 10 | 10 |
|
| 11 | 11 |
// Test the behavior of TruncIndex, an index for querying IDs from a non-conflicting prefix. |
| 12 | 12 |
func TestTruncIndex(t *testing.T) {
|
| 13 |
- ids := []string{}
|
|
| 13 |
+ var ids []string |
|
| 14 | 14 |
index := NewTruncIndex(ids) |
| 15 | 15 |
// Get on an empty index |
| 16 | 16 |
if _, err := index.Get("foobar"); err == nil {
|
| ... | ... |
@@ -33,7 +33,7 @@ import ( |
| 33 | 33 |
"github.com/docker/docker/pkg/system" |
| 34 | 34 |
"github.com/docker/docker/plugin/v2" |
| 35 | 35 |
refstore "github.com/docker/docker/reference" |
| 36 |
- digest "github.com/opencontainers/go-digest" |
|
| 36 |
+ "github.com/opencontainers/go-digest" |
|
| 37 | 37 |
specs "github.com/opencontainers/image-spec/specs-go/v1" |
| 38 | 38 |
"github.com/pkg/errors" |
| 39 | 39 |
"github.com/sirupsen/logrus" |
| ... | ... |
@@ -5,7 +5,7 @@ import ( |
| 5 | 5 |
|
| 6 | 6 |
"github.com/docker/docker/pkg/plugins" |
| 7 | 7 |
"github.com/docker/docker/plugin/v2" |
| 8 |
- specs "github.com/opencontainers/runtime-spec/specs-go" |
|
| 8 |
+ "github.com/opencontainers/runtime-spec/specs-go" |
|
| 9 | 9 |
) |
| 10 | 10 |
|
| 11 | 11 |
// Store manages the plugin inventory in memory and on-disk |
| ... | ... |
@@ -10,7 +10,7 @@ import ( |
| 10 | 10 |
|
| 11 | 11 |
"github.com/docker/docker/libcontainerd" |
| 12 | 12 |
"github.com/gotestyourself/gotestyourself/assert" |
| 13 |
- specs "github.com/opencontainers/runtime-spec/specs-go" |
|
| 13 |
+ "github.com/opencontainers/runtime-spec/specs-go" |
|
| 14 | 14 |
"github.com/pkg/errors" |
| 15 | 15 |
) |
| 16 | 16 |
|
| ... | ... |
@@ -24,7 +24,7 @@ import ( |
| 24 | 24 |
"github.com/docker/docker/plugin/v2" |
| 25 | 25 |
"github.com/docker/docker/registry" |
| 26 | 26 |
"github.com/opencontainers/go-digest" |
| 27 |
- specs "github.com/opencontainers/runtime-spec/specs-go" |
|
| 27 |
+ "github.com/opencontainers/runtime-spec/specs-go" |
|
| 28 | 28 |
"github.com/pkg/errors" |
| 29 | 29 |
"github.com/sirupsen/logrus" |
| 30 | 30 |
) |
| ... | ... |
@@ -12,7 +12,7 @@ import ( |
| 12 | 12 |
"github.com/docker/docker/pkg/system" |
| 13 | 13 |
"github.com/docker/docker/plugin/v2" |
| 14 | 14 |
"github.com/gotestyourself/gotestyourself/skip" |
| 15 |
- specs "github.com/opencontainers/runtime-spec/specs-go" |
|
| 15 |
+ "github.com/opencontainers/runtime-spec/specs-go" |
|
| 16 | 16 |
"github.com/pkg/errors" |
| 17 | 17 |
) |
| 18 | 18 |
|
| ... | ... |
@@ -9,7 +9,7 @@ import ( |
| 9 | 9 |
"github.com/docker/docker/pkg/plugingetter" |
| 10 | 10 |
"github.com/docker/docker/pkg/plugins" |
| 11 | 11 |
"github.com/docker/docker/plugin/v2" |
| 12 |
- specs "github.com/opencontainers/runtime-spec/specs-go" |
|
| 12 |
+ "github.com/opencontainers/runtime-spec/specs-go" |
|
| 13 | 13 |
"github.com/pkg/errors" |
| 14 | 14 |
"github.com/sirupsen/logrus" |
| 15 | 15 |
) |
| ... | ... |
@@ -18,13 +18,13 @@ import ( |
| 18 | 18 |
* When the time comes to remove support for V1 plugins, flipping |
| 19 | 19 |
* this bool is all that will be needed. |
| 20 | 20 |
*/ |
| 21 |
-const allowV1PluginsFallback bool = true |
|
| 21 |
+const allowV1PluginsFallback = true |
|
| 22 | 22 |
|
| 23 | 23 |
/* defaultAPIVersion is the version of the plugin API for volume, network, |
| 24 | 24 |
IPAM and authz. This is a very stable API. When we update this API, then |
| 25 | 25 |
pluginType should include a version. e.g. "networkdriver/2.0". |
| 26 | 26 |
*/ |
| 27 |
-const defaultAPIVersion string = "1.0" |
|
| 27 |
+const defaultAPIVersion = "1.0" |
|
| 28 | 28 |
|
| 29 | 29 |
// GetV2Plugin retrieves a plugin by name, id or partial ID. |
| 30 | 30 |
func (ps *Store) GetV2Plugin(refOrID string) (*v2.Plugin, error) {
|
| ... | ... |
@@ -10,7 +10,7 @@ import ( |
| 10 | 10 |
"github.com/docker/docker/pkg/plugingetter" |
| 11 | 11 |
"github.com/docker/docker/pkg/plugins" |
| 12 | 12 |
"github.com/opencontainers/go-digest" |
| 13 |
- specs "github.com/opencontainers/runtime-spec/specs-go" |
|
| 13 |
+ "github.com/opencontainers/runtime-spec/specs-go" |
|
| 14 | 14 |
) |
| 15 | 15 |
|
| 16 | 16 |
// Plugin represents an individual plugin. |
| ... | ... |
@@ -9,7 +9,7 @@ import ( |
| 9 | 9 |
"github.com/docker/docker/api/types" |
| 10 | 10 |
"github.com/docker/docker/oci" |
| 11 | 11 |
"github.com/docker/docker/pkg/system" |
| 12 |
- specs "github.com/opencontainers/runtime-spec/specs-go" |
|
| 12 |
+ "github.com/opencontainers/runtime-spec/specs-go" |
|
| 13 | 13 |
"github.com/pkg/errors" |
| 14 | 14 |
) |
| 15 | 15 |
|
| ... | ... |
@@ -11,7 +11,7 @@ import ( |
| 11 | 11 |
"github.com/docker/distribution/reference" |
| 12 | 12 |
"github.com/gotestyourself/gotestyourself/assert" |
| 13 | 13 |
is "github.com/gotestyourself/gotestyourself/assert/cmp" |
| 14 |
- digest "github.com/opencontainers/go-digest" |
|
| 14 |
+ "github.com/opencontainers/go-digest" |
|
| 15 | 15 |
) |
| 16 | 16 |
|
| 17 | 17 |
var ( |
| ... | ... |
@@ -100,7 +100,7 @@ func TestLoadAllowNondistributableArtifacts(t *testing.T) {
|
| 100 | 100 |
t.Fatalf("expect no error, got '%s'", err)
|
| 101 | 101 |
} |
| 102 | 102 |
|
| 103 |
- cidrStrs := []string{}
|
|
| 103 |
+ var cidrStrs []string |
|
| 104 | 104 |
for _, c := range config.AllowNondistributableArtifactsCIDRs {
|
| 105 | 105 |
cidrStrs = append(cidrStrs, c.String()) |
| 106 | 106 |
} |
| ... | ... |
@@ -69,7 +69,7 @@ func validateEndpoint(endpoint *V1Endpoint) error {
|
| 69 | 69 |
|
| 70 | 70 |
func newV1Endpoint(address url.URL, tlsConfig *tls.Config, userAgent string, metaHeaders http.Header) *V1Endpoint {
|
| 71 | 71 |
endpoint := &V1Endpoint{
|
| 72 |
- IsSecure: (tlsConfig == nil || !tlsConfig.InsecureSkipVerify), |
|
| 72 |
+ IsSecure: tlsConfig == nil || !tlsConfig.InsecureSkipVerify, |
|
| 73 | 73 |
URL: new(url.URL), |
| 74 | 74 |
} |
| 75 | 75 |
|
| ... | ... |
@@ -430,7 +430,7 @@ func handlerImages(w http.ResponseWriter, r *http.Request) {
|
| 430 | 430 |
writeResponse(w, "", 204) |
| 431 | 431 |
return |
| 432 | 432 |
} |
| 433 |
- images := []map[string]string{}
|
|
| 433 |
+ var images []map[string]string |
|
| 434 | 434 |
for imageID, layer := range testLayers {
|
| 435 | 435 |
image := make(map[string]string) |
| 436 | 436 |
image["id"] = imageID |
| ... | ... |
@@ -3,7 +3,6 @@ package registry // import "github.com/docker/docker/registry" |
| 3 | 3 |
import ( |
| 4 | 4 |
"bytes" |
| 5 | 5 |
"crypto/sha256" |
| 6 |
- "sync" |
|
| 7 | 6 |
// this is required for some certificates |
| 8 | 7 |
_ "crypto/sha512" |
| 9 | 8 |
"encoding/hex" |
| ... | ... |
@@ -16,6 +15,7 @@ import ( |
| 16 | 16 |
"net/url" |
| 17 | 17 |
"strconv" |
| 18 | 18 |
"strings" |
| 19 |
+ "sync" |
|
| 19 | 20 |
|
| 20 | 21 |
"github.com/docker/distribution/reference" |
| 21 | 22 |
"github.com/docker/distribution/registry/api/errcode" |
| ... | ... |
@@ -370,7 +370,7 @@ func getAddress(opts string) string {
|
| 370 | 370 |
optsList := strings.Split(opts, ",") |
| 371 | 371 |
for i := 0; i < len(optsList); i++ {
|
| 372 | 372 |
if strings.HasPrefix(optsList[i], "addr=") {
|
| 373 |
- addr := (strings.SplitN(optsList[i], "=", 2)[1]) |
|
| 373 |
+ addr := strings.SplitN(optsList[i], "=", 2)[1] |
|
| 374 | 374 |
return addr |
| 375 | 375 |
} |
| 376 | 376 |
} |