fix a few golint errors

Signed-off-by: Victor Vieux <victorvieux@gmail.com>
This commit is contained in:
Victor Vieux 2016-11-18 15:57:11 -08:00
parent 697b6b504a
commit 9c559e6d0b
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

@ -81,7 +81,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
}