Merge pull request #28611 from vieux/fix_golint

fix a few golint errors
This commit is contained in:
Doug Davis 2016-11-19 07:16:44 -05:00 committed by GitHub
commit 96f50e9b70
12 changed files with 23 additions and 21 deletions

View File

@ -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

View File

@ -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() {

View File

@ -1052,10 +1052,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.

View File

@ -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 {

View File

@ -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)

View File

@ -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

View File

@ -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) {
}

View File

@ -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 {

View File

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

View File

@ -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 {

View File

@ -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
}

View File

@ -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
}