Sfoglia il codice sorgente

fix a few golint errors

Signed-off-by: Victor Vieux <victorvieux@gmail.com>
(cherry picked from commit 9c559e6d0b7190b4698de59e692a047beba017fd)
Signed-off-by: Victor Vieux <victorvieux@gmail.com>
Victor Vieux 8 anni fa
parent
commit
4edaaeb671

+ 1 - 0
api/types/versions/v1p24/types.go

@@ -3,6 +3,7 @@ package v1p24
 
 import "github.com/docker/docker/api/types"
 
+// Info is a backcompatibility struct for the API 1.24
 type Info struct {
 	*types.InfoBase
 	ExecutionDriver string

+ 1 - 1
cmd/docker/docker.go

@@ -90,7 +90,7 @@ func noArgs(cmd *cobra.Command, args []string) error {
 		return nil
 	}
 	return fmt.Errorf(
-		"docker: '%s' is not a docker command.\nSee 'docker --help'.", args[0])
+		"docker: '%s' is not a docker command.\nSee 'docker --help'", args[0])
 }
 
 func main() {

+ 2 - 3
daemon/cluster/cluster.go

@@ -1055,10 +1055,9 @@ func (c *Cluster) imageWithDigestString(ctx context.Context, image string, authC
 			return "", err
 		}
 		return namedDigestedRef.String(), nil
-	} else {
-		// reference already contains a digest, so just return it
-		return ref.String(), nil
 	}
+	// reference already contains a digest, so just return it
+	return ref.String(), nil
 }
 
 // CreateService creates a new service in a managed swarm cluster.

+ 2 - 4
daemon/graphdriver/windows/windows.go

@@ -165,18 +165,16 @@ func (d *Driver) Exists(id string) bool {
 func (d *Driver) CreateReadWrite(id, parent string, opts *graphdriver.CreateOpts) error {
 	if opts != nil {
 		return d.create(id, parent, opts.MountLabel, false, opts.StorageOpt)
-	} else {
-		return d.create(id, parent, "", false, nil)
 	}
+	return d.create(id, parent, "", false, nil)
 }
 
 // Create creates a new read-only layer with the given id.
 func (d *Driver) Create(id, parent string, opts *graphdriver.CreateOpts) error {
 	if opts != nil {
 		return d.create(id, parent, opts.MountLabel, true, opts.StorageOpt)
-	} else {
-		return d.create(id, parent, "", true, nil)
 	}
+	return d.create(id, parent, "", true, nil)
 }
 
 func (d *Driver) create(id, parent, mountLabel string, readOnly bool, storageOpt map[string]string) error {

+ 1 - 0
daemon/image_pull.go

@@ -106,6 +106,7 @@ func (daemon *Daemon) pullImageWithReference(ctx context.Context, ref reference.
 	return err
 }
 
+// GetRepository returns a repository from the registry.
 func (daemon *Daemon) GetRepository(ctx context.Context, ref reference.NamedTagged, authConfig *types.AuthConfig) (dist.Repository, bool, error) {
 	// get repository info
 	repoInfo, err := daemon.RegistryService.ResolveRepository(ref)

+ 1 - 0
daemon/info_unix.go

@@ -13,6 +13,7 @@ import (
 	"github.com/docker/docker/pkg/sysinfo"
 )
 
+// FillPlatformInfo fills the platform related info.
 func (daemon *Daemon) FillPlatformInfo(v *types.InfoBase, sysInfo *sysinfo.SysInfo) {
 	v.MemoryLimit = sysInfo.MemoryLimit
 	v.SwapLimit = sysInfo.SwapLimit

+ 1 - 0
daemon/info_windows.go

@@ -5,5 +5,6 @@ import (
 	"github.com/docker/docker/pkg/sysinfo"
 )
 
+// FillPlatformInfo fills the platform related info.
 func (daemon *Daemon) FillPlatformInfo(v *types.InfoBase, sysInfo *sysinfo.SysInfo) {
 }

+ 1 - 1
integration-cli/docker_cli_help_test.go

@@ -196,7 +196,7 @@ func (s *DockerSuite) TestHelpExitCodesHelpOutput(c *check.C) {
 	stdout, stderr, _, err = runCommandWithStdoutStderr(cmd)
 	c.Assert(err, checker.NotNil)
 	c.Assert(stdout, checker.Equals, "")
-	c.Assert(stderr, checker.Equals, "docker: 'BadCmd' is not a docker command.\nSee 'docker --help'.\n", check.Commentf("Unexcepted output for 'docker badCmd'\n"))
+	c.Assert(stderr, checker.Equals, "docker: 'BadCmd' is not a docker command.\nSee 'docker --help'\n", check.Commentf("Unexcepted output for 'docker badCmd'\n"))
 }
 
 func testCommand(cmd string, newEnvs []string, scanForHome bool, home string) error {

+ 1 - 0
opts/port.go

@@ -16,6 +16,7 @@ const (
 	portOptMode          = "mode"
 )
 
+// PortOpt represents a port config in swarm mode.
 type PortOpt struct {
 	ports []swarm.PortConfig
 }

+ 1 - 1
pkg/devicemapper/devmapper_wrapper_no_deferred_remove.go

@@ -2,7 +2,7 @@
 
 package devicemapper
 
-// LibraryDeferredRemovalsupport is not supported when statically linked.
+// LibraryDeferredRemovalSupport is not supported when statically linked.
 const LibraryDeferredRemovalSupport = false
 
 func dmTaskDeferredRemoveFct(task *cdmTask) int {

+ 10 - 10
plugin/backend_unsupported.go

@@ -11,50 +11,50 @@ import (
 	"golang.org/x/net/context"
 )
 
-var ErrNotSupported = errors.New("plugins are not supported on this platform")
+var errNotSupported = errors.New("plugins are not supported on this platform")
 
 // Disable deactivates a plugin, which implies that they cannot be used by containers.
 func (pm *Manager) Disable(name string) error {
-	return ErrNotSupported
+	return errNotSupported
 }
 
 // Enable activates a plugin, which implies that they are ready to be used by containers.
 func (pm *Manager) Enable(name string) error {
-	return ErrNotSupported
+	return errNotSupported
 }
 
 // Inspect examines a plugin config
 func (pm *Manager) Inspect(name string) (tp types.Plugin, err error) {
-	return tp, ErrNotSupported
+	return tp, errNotSupported
 }
 
 // Pull pulls a plugin and computes the privileges required to install it.
 func (pm *Manager) Pull(name string, metaHeader http.Header, authConfig *types.AuthConfig) (types.PluginPrivileges, error) {
-	return nil, ErrNotSupported
+	return nil, errNotSupported
 }
 
 // List displays the list of plugins and associated metadata.
 func (pm *Manager) List() ([]types.Plugin, error) {
-	return nil, ErrNotSupported
+	return nil, errNotSupported
 }
 
 // Push pushes a plugin to the store.
 func (pm *Manager) Push(name string, metaHeader http.Header, authConfig *types.AuthConfig) error {
-	return ErrNotSupported
+	return errNotSupported
 }
 
 // Remove deletes plugin's root directory.
 func (pm *Manager) Remove(name string, config *types.PluginRmConfig) error {
-	return ErrNotSupported
+	return errNotSupported
 }
 
 // Set sets plugin args
 func (pm *Manager) Set(name string, args []string) error {
-	return ErrNotSupported
+	return errNotSupported
 }
 
 // CreateFromContext creates a plugin from the given pluginDir which contains
 // both the rootfs and the config.json and a repoName with optional tag.
 func (pm *Manager) CreateFromContext(ctx context.Context, tarCtx io.Reader, options *types.PluginCreateOptions) error {
-	return ErrNotSupported
+	return errNotSupported
 }

+ 1 - 1
volume/local/local.go

@@ -269,7 +269,7 @@ func (r *Root) validateName(name string) error {
 		return validationError{fmt.Errorf("volume name is too short, names should be at least two alphanumeric characters")}
 	}
 	if !volumeNameRegex.MatchString(name) {
-		return validationError{fmt.Errorf("%q includes invalid characters for a local volume name, only %q are allowed. If you intented to pass a host directory, use absolute path.", name, utils.RestrictedNameChars)}
+		return validationError{fmt.Errorf("%q includes invalid characters for a local volume name, only %q are allowed. If you intented to pass a host directory, use absolute path", name, utils.RestrictedNameChars)}
 	}
 	return nil
 }