Signed-off-by: Daniel Nephin <dnephin@docker.com>
| ... | ... |
@@ -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 |
| ... | ... |
@@ -2,7 +2,12 @@ |
| 2 | 2 |
"Vendor": true, |
| 3 | 3 |
"Deadline": "2m", |
| 4 | 4 |
"Sort": ["linter", "severity", "path"], |
| 5 |
- "Exclude": [".*\\.pb\\.go"], |
|
| 5 |
+ "Exclude": [ |
|
| 6 |
+ ".*\\.pb\\.go", |
|
| 7 |
+ "dockerversion/version_autogen.go", |
|
| 8 |
+ "api/types/container/container_.*", |
|
| 9 |
+ "integration-cli/" |
|
| 10 |
+ ], |
|
| 6 | 11 |
|
| 7 | 12 |
"Enable": [ |
| 8 | 13 |
"gofmt", |
| ... | ... |
@@ -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 |
} |