| ... | ... |
@@ -115,17 +115,6 @@ RUN curl -fsSL "https://golang.org/dl/go${GO_VERSION}.linux-amd64.tar.gz" \
|
| 115 | 115 |
ENV PATH /go/bin:/usr/local/go/bin:$PATH |
| 116 | 116 |
ENV GOPATH /go |
| 117 | 117 |
|
| 118 |
-# Dependency for golint |
|
| 119 |
-ENV GO_TOOLS_COMMIT 823804e1ae08dbb14eb807afc7db9993bc9e3cc3 |
|
| 120 |
-RUN git clone https://github.com/golang/tools.git /go/src/golang.org/x/tools \ |
|
| 121 |
- && (cd /go/src/golang.org/x/tools && git checkout -q $GO_TOOLS_COMMIT) |
|
| 122 |
- |
|
| 123 |
-# Grab Go's lint tool |
|
| 124 |
-ENV GO_LINT_COMMIT 32a87160691b3c96046c0c678fe57c5bef761456 |
|
| 125 |
-RUN git clone https://github.com/golang/lint.git /go/src/github.com/golang/lint \ |
|
| 126 |
- && (cd /go/src/github.com/golang/lint && git checkout -q $GO_LINT_COMMIT) \ |
|
| 127 |
- && go install -v github.com/golang/lint/golint |
|
| 128 |
- |
|
| 129 | 118 |
# Install CRIU for checkpoint/restore support |
| 130 | 119 |
ENV CRIU_VERSION 2.12.1 |
| 131 | 120 |
# Install dependancy packages specific to criu |
| ... | ... |
@@ -215,7 +204,7 @@ RUN ./contrib/download-frozen-image-v2.sh /docker-frozen-images \ |
| 215 | 215 |
# Please edit hack/dockerfile/install-binaries.sh to update them. |
| 216 | 216 |
COPY hack/dockerfile/binaries-commits /tmp/binaries-commits |
| 217 | 217 |
COPY hack/dockerfile/install-binaries.sh /tmp/install-binaries.sh |
| 218 |
-RUN /tmp/install-binaries.sh tomlv vndr runc containerd tini proxy dockercli |
|
| 218 |
+RUN /tmp/install-binaries.sh tomlv vndr runc containerd tini proxy dockercli gometalinter |
|
| 219 | 219 |
ENV PATH=/usr/local/cli:$PATH |
| 220 | 220 |
|
| 221 | 221 |
# Activate bash completion and include Docker's completion if mounted with DOCKER_BASH_COMPLETION_PATH |
| ... | ... |
@@ -98,17 +98,6 @@ RUN mkdir /usr/src/go && curl -fsSL https://golang.org/dl/go${GO_VERSION}.src.ta
|
| 98 | 98 |
ENV PATH /go/bin:/usr/src/go/bin:$PATH |
| 99 | 99 |
ENV GOPATH /go |
| 100 | 100 |
|
| 101 |
-# Dependency for golint |
|
| 102 |
-ENV GO_TOOLS_COMMIT 823804e1ae08dbb14eb807afc7db9993bc9e3cc3 |
|
| 103 |
-RUN git clone https://github.com/golang/tools.git /go/src/golang.org/x/tools \ |
|
| 104 |
- && (cd /go/src/golang.org/x/tools && git checkout -q $GO_TOOLS_COMMIT) |
|
| 105 |
- |
|
| 106 |
-# Grab Go's lint tool |
|
| 107 |
-ENV GO_LINT_COMMIT 32a87160691b3c96046c0c678fe57c5bef761456 |
|
| 108 |
-RUN git clone https://github.com/golang/lint.git /go/src/github.com/golang/lint \ |
|
| 109 |
- && (cd /go/src/github.com/golang/lint && git checkout -q $GO_LINT_COMMIT) \ |
|
| 110 |
- && go install -v github.com/golang/lint/golint |
|
| 111 |
- |
|
| 112 | 101 |
# Only install one version of the registry, because old version which support |
| 113 | 102 |
# schema1 manifests is not working on ARM64, we should skip integration-cli |
| 114 | 103 |
# tests for schema1 manifests on ARM64. |
| ... | ... |
@@ -81,17 +81,6 @@ ENV GOPATH /go |
| 81 | 81 |
ENV GOARCH arm |
| 82 | 82 |
ENV GOARM 7 |
| 83 | 83 |
|
| 84 |
-# Dependency for golint |
|
| 85 |
-ENV GO_TOOLS_COMMIT 823804e1ae08dbb14eb807afc7db9993bc9e3cc3 |
|
| 86 |
-RUN git clone https://github.com/golang/tools.git /go/src/golang.org/x/tools \ |
|
| 87 |
- && (cd /go/src/golang.org/x/tools && git checkout -q $GO_TOOLS_COMMIT) |
|
| 88 |
- |
|
| 89 |
-# Grab Go's lint tool |
|
| 90 |
-ENV GO_LINT_COMMIT 32a87160691b3c96046c0c678fe57c5bef761456 |
|
| 91 |
-RUN git clone https://github.com/golang/lint.git /go/src/github.com/golang/lint \ |
|
| 92 |
- && (cd /go/src/github.com/golang/lint && git checkout -q $GO_LINT_COMMIT) \ |
|
| 93 |
- && go install -v github.com/golang/lint/golint |
|
| 94 |
- |
|
| 95 | 84 |
# Install seccomp: the version shipped upstream is too old |
| 96 | 85 |
ENV SECCOMP_VERSION 2.3.2 |
| 97 | 86 |
RUN set -x \ |
| ... | ... |
@@ -94,17 +94,6 @@ RUN curl -fsSL "https://golang.org/dl/go${GO_VERSION}.linux-ppc64le.tar.gz" \
|
| 94 | 94 |
ENV PATH /go/bin:/usr/local/go/bin:$PATH |
| 95 | 95 |
ENV GOPATH /go |
| 96 | 96 |
|
| 97 |
-# Dependency for golint |
|
| 98 |
-ENV GO_TOOLS_COMMIT 823804e1ae08dbb14eb807afc7db9993bc9e3cc3 |
|
| 99 |
-RUN git clone https://github.com/golang/tools.git /go/src/golang.org/x/tools \ |
|
| 100 |
- && (cd /go/src/golang.org/x/tools && git checkout -q $GO_TOOLS_COMMIT) |
|
| 101 |
- |
|
| 102 |
-# Grab Go's lint tool |
|
| 103 |
-ENV GO_LINT_COMMIT 32a87160691b3c96046c0c678fe57c5bef761456 |
|
| 104 |
-RUN git clone https://github.com/golang/lint.git /go/src/github.com/golang/lint \ |
|
| 105 |
- && (cd /go/src/github.com/golang/lint && git checkout -q $GO_LINT_COMMIT) \ |
|
| 106 |
- && go install -v github.com/golang/lint/golint |
|
| 107 |
- |
|
| 108 | 97 |
# Install two versions of the registry. The first is an older version that |
| 109 | 98 |
# only supports schema1 manifests. The second is a newer version that supports |
| 110 | 99 |
# both. This allows integration-cli tests to cover push/pull with both schema1 |
| ... | ... |
@@ -87,17 +87,6 @@ RUN curl -fsSL "https://golang.org/dl/go${GO_VERSION}.linux-s390x.tar.gz" \
|
| 87 | 87 |
ENV PATH /go/bin:/usr/local/go/bin:$PATH |
| 88 | 88 |
ENV GOPATH /go |
| 89 | 89 |
|
| 90 |
-# Dependency for golint |
|
| 91 |
-ENV GO_TOOLS_COMMIT 823804e1ae08dbb14eb807afc7db9993bc9e3cc3 |
|
| 92 |
-RUN git clone https://github.com/golang/tools.git /go/src/golang.org/x/tools \ |
|
| 93 |
- && (cd /go/src/golang.org/x/tools && git checkout -q $GO_TOOLS_COMMIT) |
|
| 94 |
- |
|
| 95 |
-# Grab Go's lint tool |
|
| 96 |
-ENV GO_LINT_COMMIT 32a87160691b3c96046c0c678fe57c5bef761456 |
|
| 97 |
-RUN git clone https://github.com/golang/lint.git /go/src/github.com/golang/lint \ |
|
| 98 |
- && (cd /go/src/github.com/golang/lint && git checkout -q $GO_LINT_COMMIT) \ |
|
| 99 |
- && go install -v github.com/golang/lint/golint |
|
| 100 |
- |
|
| 101 | 90 |
# Install two versions of the registry. The first is an older version that |
| 102 | 91 |
# only supports schema1 manifests. The second is a newer version that supports |
| 103 | 92 |
# both. This allows integration-cli tests to cover push/pull with both schema1 |
| ... | ... |
@@ -53,6 +53,7 @@ func (v VersionMiddleware) WrapHandler(handler func(ctx context.Context, w http. |
| 53 | 53 |
w.Header().Set("Server", header)
|
| 54 | 54 |
w.Header().Set("API-Version", v.defaultVersion)
|
| 55 | 55 |
w.Header().Set("OSType", runtime.GOOS)
|
| 56 |
+ // nolint: golint |
|
| 56 | 57 |
ctx = context.WithValue(ctx, "api-version", apiVersion) |
| 57 | 58 |
return handler(ctx, w, r, vars) |
| 58 | 59 |
} |
| ... | ... |
@@ -19,7 +19,7 @@ import ( |
| 19 | 19 |
) |
| 20 | 20 |
|
| 21 | 21 |
var ( |
| 22 |
- errDockerfileNotStringArray = errors.New("When using JSON array syntax, arrays must be comprised of strings only.")
|
|
| 22 |
+ errDockerfileNotStringArray = errors.New("when using JSON array syntax, arrays must be comprised of strings only")
|
|
| 23 | 23 |
) |
| 24 | 24 |
|
| 25 | 25 |
const ( |
| ... | ... |
@@ -453,7 +453,7 @@ func loadDaemonCliConfig(opts *daemonOptions) (*config.Config, error) {
|
| 453 | 453 |
c, err := config.MergeDaemonConfigurations(conf, flags, opts.configFile) |
| 454 | 454 |
if err != nil {
|
| 455 | 455 |
if flags.Changed("config-file") || !os.IsNotExist(err) {
|
| 456 |
- return nil, fmt.Errorf("unable to configure the Docker daemon with file %s: %v\n", opts.configFile, err)
|
|
| 456 |
+ return nil, fmt.Errorf("unable to configure the Docker daemon with file %s: %v", opts.configFile, err)
|
|
| 457 | 457 |
} |
| 458 | 458 |
} |
| 459 | 459 |
// the merged configuration can be nil if the config file didn't exist. |
| ... | ... |
@@ -31,11 +31,11 @@ func (daemon *Daemon) ContainerAttach(prefixOrName string, c *backend.ContainerA |
| 31 | 31 |
return err |
| 32 | 32 |
} |
| 33 | 33 |
if container.IsPaused() {
|
| 34 |
- err := fmt.Errorf("Container %s is paused, unpause the container before attach.", prefixOrName)
|
|
| 34 |
+ err := fmt.Errorf("container %s is paused, unpause the container before attach", prefixOrName)
|
|
| 35 | 35 |
return stateConflictError{err}
|
| 36 | 36 |
} |
| 37 | 37 |
if container.IsRestarting() {
|
| 38 |
- err := fmt.Errorf("Container %s is restarting, wait until the container is running.", prefixOrName)
|
|
| 38 |
+ err := fmt.Errorf("container %s is restarting, wait until the container is running", prefixOrName)
|
|
| 39 | 39 |
return stateConflictError{err}
|
| 40 | 40 |
} |
| 41 | 41 |
|
| ... | ... |
@@ -66,7 +66,7 @@ var ( |
| 66 | 66 |
// containerd if none is specified |
| 67 | 67 |
DefaultRuntimeBinary = "docker-runc" |
| 68 | 68 |
|
| 69 |
- errSystemNotSupported = errors.New("The Docker daemon is not supported on this platform.")
|
|
| 69 |
+ errSystemNotSupported = errors.New("the Docker daemon is not supported on this platform")
|
|
| 70 | 70 |
) |
| 71 | 71 |
|
| 72 | 72 |
type daemonStore struct {
|
| ... | ... |
@@ -557,13 +557,13 @@ func verifyPlatformContainerSettings(daemon *Daemon, hostConfig *containertypes. |
| 557 | 557 |
// check for various conflicting options with user namespaces |
| 558 | 558 |
if daemon.configStore.RemappedRoot != "" && hostConfig.UsernsMode.IsPrivate() {
|
| 559 | 559 |
if hostConfig.Privileged {
|
| 560 |
- return warnings, fmt.Errorf("Privileged mode is incompatible with user namespaces. You must run the container in the host namespace when running privileged mode.")
|
|
| 560 |
+ return warnings, fmt.Errorf("privileged mode is incompatible with user namespaces. You must run the container in the host namespace when running privileged mode")
|
|
| 561 | 561 |
} |
| 562 | 562 |
if hostConfig.NetworkMode.IsHost() && !hostConfig.UsernsMode.IsHost() {
|
| 563 |
- return warnings, fmt.Errorf("Cannot share the host's network namespace when user namespaces are enabled")
|
|
| 563 |
+ return warnings, fmt.Errorf("cannot share the host's network namespace when user namespaces are enabled")
|
|
| 564 | 564 |
} |
| 565 | 565 |
if hostConfig.PidMode.IsHost() && !hostConfig.UsernsMode.IsHost() {
|
| 566 |
- return warnings, fmt.Errorf("Cannot share the host PID namespace when user namespaces are enabled")
|
|
| 566 |
+ return warnings, fmt.Errorf("cannot share the host PID namespace when user namespaces are enabled")
|
|
| 567 | 567 |
} |
| 568 | 568 |
} |
| 569 | 569 |
if hostConfig.CgroupParent != "" && UsingSystemd(daemon.configStore) {
|
| ... | ... |
@@ -1125,7 +1125,7 @@ func setupDaemonRoot(config *config.Config, rootDir string, rootIDs idtools.IDPa |
| 1125 | 1125 |
break |
| 1126 | 1126 |
} |
| 1127 | 1127 |
if !idtools.CanAccess(dirPath, rootIDs) {
|
| 1128 |
- return fmt.Errorf("A subdirectory in your graphroot path (%s) restricts access to the remapped root uid/gid; please fix by allowing 'o+x' permissions on existing directories.", config.Root)
|
|
| 1128 |
+ return fmt.Errorf("a subdirectory in your graphroot path (%s) restricts access to the remapped root uid/gid; please fix by allowing 'o+x' permissions on existing directories", config.Root)
|
|
| 1129 | 1129 |
} |
| 1130 | 1130 |
} |
| 1131 | 1131 |
} |
| ... | ... |
@@ -2664,7 +2664,7 @@ func NewDeviceSet(root string, doInit bool, options []string, uidMaps, gidMaps [ |
| 2664 | 2664 |
devices.metaDataLoopbackSize = size |
| 2665 | 2665 |
case "dm.fs": |
| 2666 | 2666 |
if val != "ext4" && val != "xfs" {
|
| 2667 |
- return nil, fmt.Errorf("devmapper: Unsupported filesystem %s\n", val)
|
|
| 2667 |
+ return nil, fmt.Errorf("devmapper: Unsupported filesystem %s", val)
|
|
| 2668 | 2668 |
} |
| 2669 | 2669 |
devices.filesystem = val |
| 2670 | 2670 |
case "dm.mkfsarg": |
| ... | ... |
@@ -2786,7 +2786,7 @@ func NewDeviceSet(root string, doInit bool, options []string, uidMaps, gidMaps [ |
| 2786 | 2786 |
Level: int(level), |
| 2787 | 2787 |
}) |
| 2788 | 2788 |
default: |
| 2789 |
- return nil, fmt.Errorf("devmapper: Unknown option %s\n", key)
|
|
| 2789 |
+ return nil, fmt.Errorf("devmapper: Unknown option %s", key)
|
|
| 2790 | 2790 |
} |
| 2791 | 2791 |
} |
| 2792 | 2792 |
|
| ... | ... |
@@ -121,7 +121,7 @@ func copyDir(srcDir, dstDir string, flags copyFlags) error {
|
| 121 | 121 |
} |
| 122 | 122 |
|
| 123 | 123 |
default: |
| 124 |
- return fmt.Errorf("Unknown file type for %s\n", srcPath)
|
|
| 124 |
+ return fmt.Errorf("unknown file type for %s", srcPath)
|
|
| 125 | 125 |
} |
| 126 | 126 |
|
| 127 | 127 |
// Everything below is copying metadata from src to dst. All this metadata |
| ... | ... |
@@ -101,7 +101,7 @@ func (p *cmdProbe) run(ctx context.Context, d *Daemon, cntr *container.Container |
| 101 | 101 |
return nil, err |
| 102 | 102 |
} |
| 103 | 103 |
if info.ExitCode == nil {
|
| 104 |
- return nil, fmt.Errorf("Healthcheck for container %s has no exit code!", cntr.ID)
|
|
| 104 |
+ return nil, fmt.Errorf("healthcheck for container %s has no exit code", cntr.ID)
|
|
| 105 | 105 |
} |
| 106 | 106 |
// Note: Go's json package will handle invalid UTF-8 for us |
| 107 | 107 |
out := output.String() |
| ... | ... |
@@ -162,7 +162,7 @@ func TestCreateError(t *testing.T) {
|
| 162 | 162 |
client: mockClient, |
| 163 | 163 |
} |
| 164 | 164 |
mockClient.createLogStreamResult <- &createLogStreamResult{
|
| 165 |
- errorResult: errors.New("Error!"),
|
|
| 165 |
+ errorResult: errors.New("Error"),
|
|
| 166 | 166 |
} |
| 167 | 167 |
|
| 168 | 168 |
err := stream.create() |
| ... | ... |
@@ -243,7 +243,7 @@ func TestPublishBatchError(t *testing.T) {
|
| 243 | 243 |
sequenceToken: aws.String(sequenceToken), |
| 244 | 244 |
} |
| 245 | 245 |
mockClient.putLogEventsResult <- &putLogEventsResult{
|
| 246 |
- errorResult: errors.New("Error!"),
|
|
| 246 |
+ errorResult: errors.New("Error"),
|
|
| 247 | 247 |
} |
| 248 | 248 |
|
| 249 | 249 |
events := []wrappedEvent{
|
| ... | ... |
@@ -203,7 +203,7 @@ func New(info logger.Info) (logger.Logger, error) {
|
| 203 | 203 |
} |
| 204 | 204 |
gzipCompressionLevel = int(gzipCompressionLevel64) |
| 205 | 205 |
if gzipCompressionLevel < gzip.DefaultCompression || gzipCompressionLevel > gzip.BestCompression {
|
| 206 |
- err := fmt.Errorf("Not supported level '%s' for %s (supported values between %d and %d).",
|
|
| 206 |
+ err := fmt.Errorf("not supported level '%s' for %s (supported values between %d and %d)",
|
|
| 207 | 207 |
gzipCompressionLevelStr, splunkGzipCompressionLevelKey, gzip.DefaultCompression, gzip.BestCompression) |
| 208 | 208 |
return nil, err |
| 209 | 209 |
} |
| ... | ... |
@@ -36,7 +36,7 @@ func (daemon *Daemon) StateChanged(id string, e libcontainerd.StateInfo) error {
|
| 36 | 36 |
case libcontainerd.StateOOM: |
| 37 | 37 |
// StateOOM is Linux specific and should never be hit on Windows |
| 38 | 38 |
if runtime.GOOS == "windows" {
|
| 39 |
- return errors.New("Received StateOOM from libcontainerd on Windows. This should never happen.")
|
|
| 39 |
+ return errors.New("received StateOOM from libcontainerd on Windows. This should never happen")
|
|
| 40 | 40 |
} |
| 41 | 41 |
daemon.updateHealthMonitor(c) |
| 42 | 42 |
if err := c.CheckpointTo(daemon.containersReplica); err != nil {
|
| ... | ... |
@@ -348,6 +348,7 @@ func (daemon *Daemon) createNetwork(create types.NetworkCreateRequest, id string |
| 348 | 348 |
n, err := c.NewNetwork(driver, create.Name, id, nwOptions...) |
| 349 | 349 |
if err != nil {
|
| 350 | 350 |
if _, ok := err.(libnetwork.ErrDataStoreNotInitialized); ok {
|
| 351 |
+ // nolint: golint |
|
| 351 | 352 |
return nil, errors.New("This node is not a swarm manager. Use \"docker swarm init\" or \"docker swarm join\" to connect this node to swarm and try again.")
|
| 352 | 353 |
} |
| 353 | 354 |
return nil, err |
| ... | ... |
@@ -438,7 +438,7 @@ func ensureShared(path string) error {
|
| 438 | 438 |
} |
| 439 | 439 |
|
| 440 | 440 |
if !sharedMount {
|
| 441 |
- return fmt.Errorf("Path %s is mounted on %s but it is not a shared mount.", path, sourceMount)
|
|
| 441 |
+ return fmt.Errorf("path %s is mounted on %s but it is not a shared mount", path, sourceMount)
|
|
| 442 | 442 |
} |
| 443 | 443 |
return nil |
| 444 | 444 |
} |
| ... | ... |
@@ -465,7 +465,7 @@ func ensureSharedOrSlave(path string) error {
|
| 465 | 465 |
} |
| 466 | 466 |
|
| 467 | 467 |
if !sharedMount && !slaveMount {
|
| 468 |
- return fmt.Errorf("Path %s is mounted on %s but it is not a shared or slave mount.", path, sourceMount)
|
|
| 468 |
+ return fmt.Errorf("path %s is mounted on %s but it is not a shared or slave mount", path, sourceMount)
|
|
| 469 | 469 |
} |
| 470 | 470 |
return nil |
| 471 | 471 |
} |
| ... | ... |
@@ -27,7 +27,7 @@ func (daemon *Daemon) ContainerStart(name string, hostConfig *containertypes.Hos |
| 27 | 27 |
defer container.Unlock() |
| 28 | 28 |
|
| 29 | 29 |
if container.Paused {
|
| 30 |
- return stateConflictError{errors.New("Cannot start a paused container, try unpause instead.")}
|
|
| 30 |
+ return stateConflictError{errors.New("cannot start a paused container, try unpause instead")}
|
|
| 31 | 31 |
} |
| 32 | 32 |
|
| 33 | 33 |
if container.Running {
|
| ... | ... |
@@ -35,7 +35,7 @@ func (daemon *Daemon) ContainerStart(name string, hostConfig *containertypes.Hos |
| 35 | 35 |
} |
| 36 | 36 |
|
| 37 | 37 |
if container.RemovalInProgress || container.Dead {
|
| 38 |
- return stateConflictError{errors.New("Container is marked for removal and cannot be started.")}
|
|
| 38 |
+ return stateConflictError{errors.New("container is marked for removal and cannot be started")}
|
|
| 39 | 39 |
} |
| 40 | 40 |
return nil |
| 41 | 41 |
} |
| ... | ... |
@@ -110,7 +110,7 @@ func (daemon *Daemon) containerStart(container *container.Container, checkpoint |
| 110 | 110 |
} |
| 111 | 111 |
|
| 112 | 112 |
if container.RemovalInProgress || container.Dead {
|
| 113 |
- return stateConflictError{errors.New("Container is marked for removal and cannot be started.")}
|
|
| 113 |
+ return stateConflictError{errors.New("container is marked for removal and cannot be started")}
|
|
| 114 | 114 |
} |
| 115 | 115 |
|
| 116 | 116 |
// if we encounter an error during start we need to ensure that any other |
| ... | ... |
@@ -50,7 +50,7 @@ func (daemon *Daemon) update(name string, hostConfig *container.HostConfig) erro |
| 50 | 50 |
}() |
| 51 | 51 |
|
| 52 | 52 |
if container.RemovalInProgress || container.Dead {
|
| 53 |
- return errCannotUpdate(container.ID, fmt.Errorf("Container is marked for removal and cannot be \"update\"."))
|
|
| 53 |
+ return errCannotUpdate(container.ID, fmt.Errorf("container is marked for removal and cannot be \"update\""))
|
|
| 54 | 54 |
} |
| 55 | 55 |
|
| 56 | 56 |
container.Lock() |
| ... | ... |
@@ -908,7 +908,7 @@ func fixManifestLayers(m *schema1.Manifest) error {
|
| 908 | 908 |
m.FSLayers = append(m.FSLayers[:i], m.FSLayers[i+1:]...) |
| 909 | 909 |
m.History = append(m.History[:i], m.History[i+1:]...) |
| 910 | 910 |
} else if imgs[i].Parent != imgs[i+1].ID {
|
| 911 |
- return fmt.Errorf("Invalid parent ID. Expected %v, got %v.", imgs[i+1].ID, imgs[i].Parent)
|
|
| 911 |
+ return fmt.Errorf("invalid parent ID. Expected %v, got %v", imgs[i+1].ID, imgs[i].Parent)
|
|
| 912 | 912 |
} |
| 913 | 913 |
} |
| 914 | 914 |
|
| ... | ... |
@@ -10,6 +10,7 @@ import ( |
| 10 | 10 |
|
| 11 | 11 |
"github.com/docker/distribution/manifest/schema1" |
| 12 | 12 |
"github.com/docker/distribution/reference" |
| 13 |
+ "github.com/docker/docker/pkg/testutil" |
|
| 13 | 14 |
"github.com/opencontainers/go-digest" |
| 14 | 15 |
) |
| 15 | 16 |
|
| ... | ... |
@@ -102,9 +103,8 @@ func TestFixManifestLayersBadParent(t *testing.T) {
|
| 102 | 102 |
}, |
| 103 | 103 |
} |
| 104 | 104 |
|
| 105 |
- if err := fixManifestLayers(&duplicateLayerManifest); err == nil || !strings.Contains(err.Error(), "Invalid parent ID.") {
|
|
| 106 |
- t.Fatalf("expected an invalid parent ID error from fixManifestLayers")
|
|
| 107 |
- } |
|
| 105 |
+ err := fixManifestLayers(&duplicateLayerManifest) |
|
| 106 |
+ testutil.ErrorContains(t, err, "invalid parent ID") |
|
| 108 | 107 |
} |
| 109 | 108 |
|
| 110 | 109 |
// TestValidateManifest verifies the validateManifest function |
| ... | ... |
@@ -54,6 +54,19 @@ install_dockercli() {
|
| 54 | 54 |
go build -o /usr/local/bin/docker github.com/docker/cli/cmd/docker |
| 55 | 55 |
} |
| 56 | 56 |
|
| 57 |
+install_gometalinter() {
|
|
| 58 |
+ echo "Installing gometalinter version $GOMETALINTER_COMMIT" |
|
| 59 |
+ go get -d github.com/alecthomas/gometalinter |
|
| 60 |
+ cd "$GOPATH/src/github.com/alecthomas/gometalinter" |
|
| 61 |
+ git checkout -q "$GOMETALINTER_COMMIT" |
|
| 62 |
+ go build -o /usr/local/bin/gometalinter github.com/alecthomas/gometalinter |
|
| 63 |
+ ( |
|
| 64 |
+ export GOBIN=/usr/local/bin |
|
| 65 |
+ export GOPATH="$PWD/_linters/" |
|
| 66 |
+ go install github.com/golang/lint/golint |
|
| 67 |
+ ) |
|
| 68 |
+} |
|
| 69 |
+ |
|
| 57 | 70 |
for prog in "$@" |
| 58 | 71 |
do |
| 59 | 72 |
case $prog in |
| ... | ... |
@@ -80,6 +93,10 @@ do |
| 80 | 80 |
install_containerd |
| 81 | 81 |
;; |
| 82 | 82 |
|
| 83 |
+ gometalinter) |
|
| 84 |
+ install_gometalinter |
|
| 85 |
+ ;; |
|
| 86 |
+ |
|
| 83 | 87 |
tini) |
| 84 | 88 |
echo "Install tini version $TINI_COMMIT" |
| 85 | 89 |
git clone https://github.com/krallin/tini.git "$GOPATH/tini" |
| ... | ... |
@@ -114,7 +131,7 @@ do |
| 114 | 114 |
;; |
| 115 | 115 |
|
| 116 | 116 |
*) |
| 117 |
- echo echo "Usage: $0 [tomlv|runc|runc-dynamic|containerd|containerd-dynamic|tini|proxy|proxy-dynamic|vndr|dockercli]" |
|
| 117 |
+ echo echo "Usage: $0 [tomlv|runc|runc-dynamic|containerd|containerd-dynamic|tini|proxy|proxy-dynamic|vndr|dockercli|gometalinter]" |
|
| 118 | 118 |
exit 1 |
| 119 | 119 |
|
| 120 | 120 |
esac |
| ... | ... |
@@ -6,14 +6,12 @@ export SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
| 6 | 6 |
|
| 7 | 7 |
. $SCRIPTDIR/dco |
| 8 | 8 |
. $SCRIPTDIR/default-seccomp |
| 9 |
-. $SCRIPTDIR/gofmt |
|
| 10 |
-. $SCRIPTDIR/lint |
|
| 9 |
+. $SCRIPTDIR/gometalinter |
|
| 11 | 10 |
. $SCRIPTDIR/pkg-imports |
| 12 | 11 |
. $SCRIPTDIR/swagger |
| 13 | 12 |
. $SCRIPTDIR/swagger-gen |
| 14 | 13 |
. $SCRIPTDIR/test-imports |
| 15 | 14 |
. $SCRIPTDIR/toml |
| 16 |
-. $SCRIPTDIR/vet |
|
| 17 | 15 |
. $SCRIPTDIR/changelog-well-formed |
| 18 | 16 |
. $SCRIPTDIR/changelog-date-descending |
| 19 | 17 |
. $SCRIPTDIR/deprecate-integration-cli |
| 20 | 18 |
deleted file mode 100755 |
| ... | ... |
@@ -1,33 +0,0 @@ |
| 1 |
-#!/usr/bin/env bash |
|
| 2 |
- |
|
| 3 |
-export SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|
| 4 |
-source "${SCRIPTDIR}/.validate"
|
|
| 5 |
- |
|
| 6 |
-IFS=$'\n' |
|
| 7 |
-files=( $(validate_diff --diff-filter=ACMR --name-only -- '*.go' | |
|
| 8 |
- grep -v '^vendor/' | |
|
| 9 |
- grep -v '\.pb\.go$' || true) ) |
|
| 10 |
-unset IFS |
|
| 11 |
- |
|
| 12 |
-badFiles=() |
|
| 13 |
-for f in "${files[@]}"; do
|
|
| 14 |
- # we use "git show" here to validate that what's committed is formatted |
|
| 15 |
- if [ "$(git show "$VALIDATE_HEAD:$f" | gofmt -s -l)" ]; then |
|
| 16 |
- badFiles+=( "$f" ) |
|
| 17 |
- fi |
|
| 18 |
-done |
|
| 19 |
- |
|
| 20 |
-if [ ${#badFiles[@]} -eq 0 ]; then
|
|
| 21 |
- echo 'Congratulations! All Go source files are properly formatted.' |
|
| 22 |
-else |
|
| 23 |
- {
|
|
| 24 |
- echo "These files are not properly gofmt'd:" |
|
| 25 |
- for f in "${badFiles[@]}"; do
|
|
| 26 |
- echo " - $f" |
|
| 27 |
- done |
|
| 28 |
- echo |
|
| 29 |
- echo 'Please reformat the above files using "gofmt -s -w" and commit the result.' |
|
| 30 |
- echo |
|
| 31 |
- } >&2 |
|
| 32 |
- false |
|
| 33 |
-fi |
| 0 | 6 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,19 @@ |
| 0 |
+{
|
|
| 1 |
+ "Vendor": true, |
|
| 2 |
+ "Deadline": "2m", |
|
| 3 |
+ "Sort": ["linter", "severity", "path"], |
|
| 4 |
+ "Exclude": [ |
|
| 5 |
+ ".*\\.pb\\.go", |
|
| 6 |
+ "dockerversion/version_autogen.go", |
|
| 7 |
+ "api/types/container/container_.*", |
|
| 8 |
+ "integration-cli/" |
|
| 9 |
+ ], |
|
| 10 |
+ |
|
| 11 |
+ "Enable": [ |
|
| 12 |
+ "gofmt", |
|
| 13 |
+ "golint", |
|
| 14 |
+ "vet" |
|
| 15 |
+ ], |
|
| 16 |
+ |
|
| 17 |
+ "LineLength": 200 |
|
| 18 |
+} |
| 0 | 19 |
deleted file mode 100755 |
| ... | ... |
@@ -1,31 +0,0 @@ |
| 1 |
-#!/usr/bin/env bash |
|
| 2 |
- |
|
| 3 |
-export SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|
| 4 |
-source "${SCRIPTDIR}/.validate"
|
|
| 5 |
- |
|
| 6 |
-IFS=$'\n' |
|
| 7 |
-files=( $(validate_diff --diff-filter=ACMR --name-only -- '*.go' | grep -v '^vendor/' | grep -v '^api/types/container/' | grep -v '\.pb\.go$' || true) ) |
|
| 8 |
-unset IFS |
|
| 9 |
- |
|
| 10 |
-errors=() |
|
| 11 |
-for f in "${files[@]}"; do
|
|
| 12 |
- failedLint=$(golint "$f") |
|
| 13 |
- if [ "$failedLint" ]; then |
|
| 14 |
- errors+=( "$failedLint" ) |
|
| 15 |
- fi |
|
| 16 |
-done |
|
| 17 |
- |
|
| 18 |
-if [ ${#errors[@]} -eq 0 ]; then
|
|
| 19 |
- echo 'Congratulations! All Go source files have been linted.' |
|
| 20 |
-else |
|
| 21 |
- {
|
|
| 22 |
- echo "Errors from golint:" |
|
| 23 |
- for err in "${errors[@]}"; do
|
|
| 24 |
- echo "$err" |
|
| 25 |
- done |
|
| 26 |
- echo |
|
| 27 |
- echo 'Please fix the above errors. You can test via "golint" and commit the result.' |
|
| 28 |
- echo |
|
| 29 |
- } >&2 |
|
| 30 |
- false |
|
| 31 |
-fi |
| 32 | 1 |
deleted file mode 100755 |
| ... | ... |
@@ -1,32 +0,0 @@ |
| 1 |
-#!/usr/bin/env bash |
|
| 2 |
- |
|
| 3 |
-export SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|
| 4 |
-source "${SCRIPTDIR}/.validate"
|
|
| 5 |
- |
|
| 6 |
-IFS=$'\n' |
|
| 7 |
-files=( $(validate_diff --diff-filter=ACMR --name-only -- '*.go' | grep -v '^vendor/' | grep -v '^api/types/container/' || true) ) |
|
| 8 |
-unset IFS |
|
| 9 |
- |
|
| 10 |
-errors=() |
|
| 11 |
-for f in "${files[@]}"; do
|
|
| 12 |
- failedVet=$(go vet "$f") |
|
| 13 |
- if [ "$failedVet" ]; then |
|
| 14 |
- errors+=( "$failedVet" ) |
|
| 15 |
- fi |
|
| 16 |
-done |
|
| 17 |
- |
|
| 18 |
- |
|
| 19 |
-if [ ${#errors[@]} -eq 0 ]; then
|
|
| 20 |
- echo 'Congratulations! All Go source files have been vetted.' |
|
| 21 |
-else |
|
| 22 |
- {
|
|
| 23 |
- echo "Errors from go vet:" |
|
| 24 |
- for err in "${errors[@]}"; do
|
|
| 25 |
- echo " - $err" |
|
| 26 |
- done |
|
| 27 |
- echo |
|
| 28 |
- echo 'Please fix the above errors. You can test via "go vet" and commit the result.' |
|
| 29 |
- echo |
|
| 30 |
- } >&2 |
|
| 31 |
- false |
|
| 32 |
-fi |
| ... | ... |
@@ -103,7 +103,7 @@ func (s *DockerSuite) TestStartPausedContainer(c *check.C) {
|
| 103 | 103 |
// an error should have been shown that you cannot start paused container |
| 104 | 104 |
c.Assert(err, checker.NotNil, check.Commentf("out: %s", out))
|
| 105 | 105 |
// an error should have been shown that you cannot start paused container |
| 106 |
- c.Assert(out, checker.Contains, "Cannot start a paused container, try unpause instead.") |
|
| 106 |
+ c.Assert(out, checker.Contains, "cannot start a paused container, try unpause instead") |
|
| 107 | 107 |
} |
| 108 | 108 |
|
| 109 | 109 |
func (s *DockerSuite) TestStartMultipleContainers(c *check.C) {
|
| ... | ... |
@@ -595,7 +595,7 @@ func createTarFile(path, extractDir string, hdr *tar.Header, reader io.Reader, L |
| 595 | 595 |
return nil |
| 596 | 596 |
|
| 597 | 597 |
default: |
| 598 |
- return fmt.Errorf("Unhandled tar header type %d\n", hdr.Typeflag)
|
|
| 598 |
+ return fmt.Errorf("unhandled tar header type %d", hdr.Typeflag)
|
|
| 599 | 599 |
} |
| 600 | 600 |
|
| 601 | 601 |
// Lchown is not supported on Windows. |
| ... | ... |
@@ -7,6 +7,7 @@ import ( |
| 7 | 7 |
"testing" |
| 8 | 8 |
"time" |
| 9 | 9 |
|
| 10 |
+ "github.com/stretchr/testify/assert" |
|
| 10 | 11 |
"golang.org/x/net/context" |
| 11 | 12 |
) |
| 12 | 13 |
|
| ... | ... |
@@ -14,7 +15,7 @@ import ( |
| 14 | 14 |
type errorReader struct{}
|
| 15 | 15 |
|
| 16 | 16 |
func (r *errorReader) Read(p []byte) (int, error) {
|
| 17 |
- return 0, fmt.Errorf("Error reader always fail.")
|
|
| 17 |
+ return 0, fmt.Errorf("error reader always fail")
|
|
| 18 | 18 |
} |
| 19 | 19 |
|
| 20 | 20 |
func TestReadCloserWrapperClose(t *testing.T) {
|
| ... | ... |
@@ -35,9 +36,7 @@ func TestReaderErrWrapperReadOnError(t *testing.T) {
|
| 35 | 35 |
called = true |
| 36 | 36 |
}) |
| 37 | 37 |
_, err := wrapper.Read([]byte{})
|
| 38 |
- if err == nil || !strings.Contains(err.Error(), "Error reader always fail.") {
|
|
| 39 |
- t.Fatalf("readErrWrapper should returned an error")
|
|
| 40 |
- } |
|
| 38 |
+ assert.EqualError(t, err, "error reader always fail") |
|
| 41 | 39 |
if !called {
|
| 42 | 40 |
t.Fatalf("readErrWrapper should have call the anonymous function on failure")
|
| 43 | 41 |
} |
| ... | ... |
@@ -8,11 +8,10 @@ import ( |
| 8 | 8 |
"strings" |
| 9 | 9 |
"time" |
| 10 | 10 |
|
| 11 |
- "github.com/Nvveen/Gotty" |
|
| 12 |
- |
|
| 11 |
+ gotty "github.com/Nvveen/Gotty" |
|
| 13 | 12 |
"github.com/docker/docker/pkg/jsonlog" |
| 14 | 13 |
"github.com/docker/docker/pkg/term" |
| 15 |
- "github.com/docker/go-units" |
|
| 14 |
+ units "github.com/docker/go-units" |
|
| 16 | 15 |
) |
| 17 | 16 |
|
| 18 | 17 |
// JSONError wraps a concrete Code and Message, `Code` is |
| ... | ... |
@@ -187,7 +186,7 @@ func cursorDown(out io.Writer, ti termInfo, l int) {
|
| 187 | 187 |
func (jm *JSONMessage) Display(out io.Writer, termInfo termInfo) error {
|
| 188 | 188 |
if jm.Error != nil {
|
| 189 | 189 |
if jm.Error.Code == 401 {
|
| 190 |
- return fmt.Errorf("Authentication is required.")
|
|
| 190 |
+ return fmt.Errorf("authentication is required")
|
|
| 191 | 191 |
} |
| 192 | 192 |
return jm.Error |
| 193 | 193 |
} |
| ... | ... |
@@ -10,6 +10,7 @@ import ( |
| 10 | 10 |
|
| 11 | 11 |
"github.com/docker/docker/pkg/jsonlog" |
| 12 | 12 |
"github.com/docker/docker/pkg/term" |
| 13 |
+ "github.com/stretchr/testify/assert" |
|
| 13 | 14 |
) |
| 14 | 15 |
|
| 15 | 16 |
func TestError(t *testing.T) {
|
| ... | ... |
@@ -198,9 +199,7 @@ func TestJSONMessageDisplayWithJSONError(t *testing.T) {
|
| 198 | 198 |
|
| 199 | 199 |
jsonMessage = JSONMessage{Error: &JSONError{401, "Anything"}}
|
| 200 | 200 |
err = jsonMessage.Display(data, &noTermInfo{})
|
| 201 |
- if err == nil || err.Error() != "Authentication is required." {
|
|
| 202 |
- t.Fatalf("Expected an error \"Authentication is required.\", got %q", err)
|
|
| 203 |
- } |
|
| 201 |
+ assert.EqualError(t, err, "authentication is required") |
|
| 204 | 202 |
} |
| 205 | 203 |
|
| 206 | 204 |
func TestDisplayJSONMessagesStreamInvalidJSON(t *testing.T) {
|
| ... | ... |
@@ -61,7 +61,7 @@ func (r *Result) Assert(t testingT, exp Expected) *Result {
|
| 61 | 61 |
} |
| 62 | 62 |
_, file, line, ok := runtime.Caller(1) |
| 63 | 63 |
if ok {
|
| 64 |
- t.Fatalf("at %s:%d - %s", filepath.Base(file), line, err.Error())
|
|
| 64 |
+ t.Fatalf("at %s:%d - %s\n", filepath.Base(file), line, err.Error())
|
|
| 65 | 65 |
} else {
|
| 66 | 66 |
t.Fatalf("(no file/line info) - %s", err.Error())
|
| 67 | 67 |
} |
| ... | ... |
@@ -108,7 +108,7 @@ func (r *Result) Compare(exp Expected) error {
|
| 108 | 108 |
if len(errors) == 0 {
|
| 109 | 109 |
return nil |
| 110 | 110 |
} |
| 111 |
- return fmt.Errorf("%s\nFailures:\n%s\n", r, strings.Join(errors, "\n"))
|
|
| 111 |
+ return fmt.Errorf("%s\nFailures:\n%s", r, strings.Join(errors, "\n"))
|
|
| 112 | 112 |
} |
| 113 | 113 |
|
| 114 | 114 |
func matchOutput(expected string, actual string) bool {
|
| ... | ... |
@@ -29,7 +29,7 @@ func loginV1(authConfig *types.AuthConfig, apiEndpoint APIEndpoint, userAgent st |
| 29 | 29 |
logrus.Debugf("attempting v1 login to registry endpoint %s", serverAddress)
|
| 30 | 30 |
|
| 31 | 31 |
if serverAddress == "" {
|
| 32 |
- return "", "", systemError{errors.New("Server Error: Server Address not set.")}
|
|
| 32 |
+ return "", "", systemError{errors.New("server Error: Server Address not set")}
|
|
| 33 | 33 |
} |
| 34 | 34 |
|
| 35 | 35 |
req, err := http.NewRequest("GET", serverAddress+"users/", nil)
|
| ... | ... |
@@ -354,7 +354,7 @@ func ValidateIndexName(val string) (string, error) {
|
| 354 | 354 |
val = "docker.io" |
| 355 | 355 |
} |
| 356 | 356 |
if strings.HasPrefix(val, "-") || strings.HasSuffix(val, "-") {
|
| 357 |
- return "", fmt.Errorf("Invalid index name (%s). Cannot begin or end with a hyphen.", val)
|
|
| 357 |
+ return "", fmt.Errorf("invalid index name (%s). Cannot begin or end with a hyphen", val)
|
|
| 358 | 358 |
} |
| 359 | 359 |
return val, nil |
| 360 | 360 |
} |
| ... | ... |
@@ -81,7 +81,7 @@ func ReadCertsDirectory(tlsConfig *tls.Config, directory string) error {
|
| 81 | 81 |
keyName := certName[:len(certName)-5] + ".key" |
| 82 | 82 |
logrus.Debugf("cert: %s", filepath.Join(directory, f.Name()))
|
| 83 | 83 |
if !hasFile(fs, keyName) {
|
| 84 |
- return fmt.Errorf("Missing key %s for client certificate %s. Note that CA certificates should use the extension .crt.", keyName, certName)
|
|
| 84 |
+ return fmt.Errorf("missing key %s for client certificate %s. Note that CA certificates should use the extension .crt", keyName, certName)
|
|
| 85 | 85 |
} |
| 86 | 86 |
cert, err := tls.LoadX509KeyPair(filepath.Join(directory, certName), filepath.Join(directory, keyName)) |
| 87 | 87 |
if err != nil {
|
| ... | ... |
@@ -434,7 +434,7 @@ func (r *Session) GetRepositoryData(name reference.Named) (*RepositoryData, erro |
| 434 | 434 |
// "Get https://index.docker.io/v1/repositories/library/busybox/images: i/o timeout" |
| 435 | 435 |
// was a top search on the docker user forum |
| 436 | 436 |
if isTimeout(err) {
|
| 437 |
- return nil, fmt.Errorf("Network timed out while trying to connect to %s. You may want to check your internet connection or if you are behind a proxy.", repositoryTarget)
|
|
| 437 |
+ return nil, fmt.Errorf("network timed out while trying to connect to %s. You may want to check your internet connection or if you are behind a proxy", repositoryTarget)
|
|
| 438 | 438 |
} |
| 439 | 439 |
return nil, fmt.Errorf("Error while pulling image: %v", err)
|
| 440 | 440 |
} |