mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Merge pull request #28611 from vieux/fix_golint
fix a few golint errors
This commit is contained in:
commit
96f50e9b70
12 changed files with 23 additions and 21 deletions
|
@ -3,6 +3,7 @@ package v1p24
|
||||||
|
|
||||||
import "github.com/docker/docker/api/types"
|
import "github.com/docker/docker/api/types"
|
||||||
|
|
||||||
|
// Info is a backcompatibility struct for the API 1.24
|
||||||
type Info struct {
|
type Info struct {
|
||||||
*types.InfoBase
|
*types.InfoBase
|
||||||
ExecutionDriver string
|
ExecutionDriver string
|
||||||
|
|
|
@ -90,7 +90,7 @@ func noArgs(cmd *cobra.Command, args []string) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
return fmt.Errorf(
|
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() {
|
func main() {
|
||||||
|
|
|
@ -1052,10 +1052,9 @@ func (c *Cluster) imageWithDigestString(ctx context.Context, image string, authC
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
return namedDigestedRef.String(), nil
|
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.
|
// CreateService creates a new service in a managed swarm cluster.
|
||||||
|
|
|
@ -165,18 +165,16 @@ func (d *Driver) Exists(id string) bool {
|
||||||
func (d *Driver) CreateReadWrite(id, parent string, opts *graphdriver.CreateOpts) error {
|
func (d *Driver) CreateReadWrite(id, parent string, opts *graphdriver.CreateOpts) error {
|
||||||
if opts != nil {
|
if opts != nil {
|
||||||
return d.create(id, parent, opts.MountLabel, false, opts.StorageOpt)
|
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.
|
// Create creates a new read-only layer with the given id.
|
||||||
func (d *Driver) Create(id, parent string, opts *graphdriver.CreateOpts) error {
|
func (d *Driver) Create(id, parent string, opts *graphdriver.CreateOpts) error {
|
||||||
if opts != nil {
|
if opts != nil {
|
||||||
return d.create(id, parent, opts.MountLabel, true, opts.StorageOpt)
|
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 {
|
func (d *Driver) create(id, parent, mountLabel string, readOnly bool, storageOpt map[string]string) error {
|
||||||
|
|
|
@ -106,6 +106,7 @@ func (daemon *Daemon) pullImageWithReference(ctx context.Context, ref reference.
|
||||||
return err
|
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) {
|
func (daemon *Daemon) GetRepository(ctx context.Context, ref reference.NamedTagged, authConfig *types.AuthConfig) (dist.Repository, bool, error) {
|
||||||
// get repository info
|
// get repository info
|
||||||
repoInfo, err := daemon.RegistryService.ResolveRepository(ref)
|
repoInfo, err := daemon.RegistryService.ResolveRepository(ref)
|
||||||
|
|
|
@ -13,6 +13,7 @@ import (
|
||||||
"github.com/docker/docker/pkg/sysinfo"
|
"github.com/docker/docker/pkg/sysinfo"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// FillPlatformInfo fills the platform related info.
|
||||||
func (daemon *Daemon) FillPlatformInfo(v *types.InfoBase, sysInfo *sysinfo.SysInfo) {
|
func (daemon *Daemon) FillPlatformInfo(v *types.InfoBase, sysInfo *sysinfo.SysInfo) {
|
||||||
v.MemoryLimit = sysInfo.MemoryLimit
|
v.MemoryLimit = sysInfo.MemoryLimit
|
||||||
v.SwapLimit = sysInfo.SwapLimit
|
v.SwapLimit = sysInfo.SwapLimit
|
||||||
|
|
|
@ -5,5 +5,6 @@ import (
|
||||||
"github.com/docker/docker/pkg/sysinfo"
|
"github.com/docker/docker/pkg/sysinfo"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// FillPlatformInfo fills the platform related info.
|
||||||
func (daemon *Daemon) FillPlatformInfo(v *types.InfoBase, sysInfo *sysinfo.SysInfo) {
|
func (daemon *Daemon) FillPlatformInfo(v *types.InfoBase, sysInfo *sysinfo.SysInfo) {
|
||||||
}
|
}
|
||||||
|
|
|
@ -196,7 +196,7 @@ func (s *DockerSuite) TestHelpExitCodesHelpOutput(c *check.C) {
|
||||||
stdout, stderr, _, err = runCommandWithStdoutStderr(cmd)
|
stdout, stderr, _, err = runCommandWithStdoutStderr(cmd)
|
||||||
c.Assert(err, checker.NotNil)
|
c.Assert(err, checker.NotNil)
|
||||||
c.Assert(stdout, checker.Equals, "")
|
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 {
|
func testCommand(cmd string, newEnvs []string, scanForHome bool, home string) error {
|
||||||
|
|
|
@ -16,6 +16,7 @@ const (
|
||||||
portOptMode = "mode"
|
portOptMode = "mode"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// PortOpt represents a port config in swarm mode.
|
||||||
type PortOpt struct {
|
type PortOpt struct {
|
||||||
ports []swarm.PortConfig
|
ports []swarm.PortConfig
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
package devicemapper
|
package devicemapper
|
||||||
|
|
||||||
// LibraryDeferredRemovalsupport is not supported when statically linked.
|
// LibraryDeferredRemovalSupport is not supported when statically linked.
|
||||||
const LibraryDeferredRemovalSupport = false
|
const LibraryDeferredRemovalSupport = false
|
||||||
|
|
||||||
func dmTaskDeferredRemoveFct(task *cdmTask) int {
|
func dmTaskDeferredRemoveFct(task *cdmTask) int {
|
||||||
|
|
|
@ -11,50 +11,50 @@ import (
|
||||||
"golang.org/x/net/context"
|
"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.
|
// Disable deactivates a plugin, which implies that they cannot be used by containers.
|
||||||
func (pm *Manager) Disable(name string) error {
|
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.
|
// Enable activates a plugin, which implies that they are ready to be used by containers.
|
||||||
func (pm *Manager) Enable(name string) error {
|
func (pm *Manager) Enable(name string) error {
|
||||||
return ErrNotSupported
|
return errNotSupported
|
||||||
}
|
}
|
||||||
|
|
||||||
// Inspect examines a plugin config
|
// Inspect examines a plugin config
|
||||||
func (pm *Manager) Inspect(name string) (tp types.Plugin, err error) {
|
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.
|
// 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) {
|
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.
|
// List displays the list of plugins and associated metadata.
|
||||||
func (pm *Manager) List() ([]types.Plugin, error) {
|
func (pm *Manager) List() ([]types.Plugin, error) {
|
||||||
return nil, ErrNotSupported
|
return nil, errNotSupported
|
||||||
}
|
}
|
||||||
|
|
||||||
// Push pushes a plugin to the store.
|
// Push pushes a plugin to the store.
|
||||||
func (pm *Manager) Push(name string, metaHeader http.Header, authConfig *types.AuthConfig) error {
|
func (pm *Manager) Push(name string, metaHeader http.Header, authConfig *types.AuthConfig) error {
|
||||||
return ErrNotSupported
|
return errNotSupported
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove deletes plugin's root directory.
|
// Remove deletes plugin's root directory.
|
||||||
func (pm *Manager) Remove(name string, config *types.PluginRmConfig) error {
|
func (pm *Manager) Remove(name string, config *types.PluginRmConfig) error {
|
||||||
return ErrNotSupported
|
return errNotSupported
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set sets plugin args
|
// Set sets plugin args
|
||||||
func (pm *Manager) Set(name string, args []string) error {
|
func (pm *Manager) Set(name string, args []string) error {
|
||||||
return ErrNotSupported
|
return errNotSupported
|
||||||
}
|
}
|
||||||
|
|
||||||
// CreateFromContext creates a plugin from the given pluginDir which contains
|
// CreateFromContext creates a plugin from the given pluginDir which contains
|
||||||
// both the rootfs and the config.json and a repoName with optional tag.
|
// 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 {
|
func (pm *Manager) CreateFromContext(ctx context.Context, tarCtx io.Reader, options *types.PluginCreateOptions) error {
|
||||||
return ErrNotSupported
|
return errNotSupported
|
||||||
}
|
}
|
||||||
|
|
|
@ -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")}
|
return validationError{fmt.Errorf("volume name is too short, names should be at least two alphanumeric characters")}
|
||||||
}
|
}
|
||||||
if !volumeNameRegex.MatchString(name) {
|
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
|
return nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue