mirror of
https://github.com/moby/moby.git
synced 2026-01-11 18:51:37 +00:00
Merge pull request #48095 from coolljt0725/remove_unnecessary_return
cleanup: Remove unnecessary return value
This commit is contained in:
@@ -10,7 +10,7 @@ import (
|
||||
)
|
||||
|
||||
// installCommonConfigFlags adds flags to the pflag.FlagSet to configure the daemon
|
||||
func installCommonConfigFlags(conf *config.Config, flags *pflag.FlagSet) error {
|
||||
func installCommonConfigFlags(conf *config.Config, flags *pflag.FlagSet) {
|
||||
var (
|
||||
allowNonDistributable = opts.NewNamedListOptsRef("allow-nondistributable-artifacts", &conf.AllowNondistributableArtifacts, registry.ValidateIndexName)
|
||||
registryMirrors = opts.NewNamedListOptsRef("registry-mirrors", &conf.Mirrors, registry.ValidateMirror)
|
||||
@@ -79,6 +79,4 @@ func installCommonConfigFlags(conf *config.Config, flags *pflag.FlagSet) error {
|
||||
_ = flags.MarkDeprecated("api-cors-header", "accessing Docker API through a browser is insecure; use a reverse proxy if you need CORS headers")
|
||||
flags.BoolVarP(&conf.AutoRestart, "restart", "r", true, "--restart on the daemon has been deprecated in favor of --restart policies on docker run")
|
||||
_ = flags.MarkDeprecated("restart", "Please use a restart policy on docker run")
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -15,11 +15,9 @@ import (
|
||||
)
|
||||
|
||||
// installConfigFlags adds flags to the pflag.FlagSet to configure the daemon
|
||||
func installConfigFlags(conf *config.Config, flags *pflag.FlagSet) error {
|
||||
func installConfigFlags(conf *config.Config, flags *pflag.FlagSet) {
|
||||
// First handle install flags which are consistent cross-platform
|
||||
if err := installCommonConfigFlags(conf, flags); err != nil {
|
||||
return err
|
||||
}
|
||||
installCommonConfigFlags(conf, flags)
|
||||
|
||||
// Then platform-specific install flags
|
||||
flags.Var(opts.NewNamedRuntimeOpt("runtimes", &conf.Runtimes, config.StockRuntimeName), "add-runtime", "Register an additional OCI compatible runtime")
|
||||
@@ -58,7 +56,6 @@ func installConfigFlags(conf *config.Config, flags *pflag.FlagSet) error {
|
||||
// Note that conf.BridgeConfig.UserlandProxyPath and honorXDG are configured according to the value of rootless.RunningWithRootlessKit, not the value of --rootless.
|
||||
flags.BoolVar(&conf.Rootless, "rootless", conf.Rootless, "Enable rootless mode; typically used with RootlessKit")
|
||||
flags.StringVar(&conf.CgroupNamespaceMode, "default-cgroupns-mode", conf.CgroupNamespaceMode, `Default mode for containers cgroup namespace ("host" | "private")`)
|
||||
return nil
|
||||
}
|
||||
|
||||
// configureCertsDir configures registry.CertsDir() depending on if the daemon
|
||||
|
||||
@@ -16,8 +16,7 @@ func TestDaemonParseShmSize(t *testing.T) {
|
||||
|
||||
conf, err := config.New()
|
||||
assert.NilError(t, err)
|
||||
err = installConfigFlags(conf, flags)
|
||||
assert.NilError(t, err)
|
||||
installConfigFlags(conf, flags)
|
||||
// By default `--default-shm-size=64M`
|
||||
assert.Check(t, is.Equal(int64(64*1024*1024), conf.ShmSize.Value()))
|
||||
assert.Check(t, flags.Set("default-shm-size", "128M"))
|
||||
|
||||
@@ -6,17 +6,14 @@ import (
|
||||
)
|
||||
|
||||
// installConfigFlags adds flags to the pflag.FlagSet to configure the daemon
|
||||
func installConfigFlags(conf *config.Config, flags *pflag.FlagSet) error {
|
||||
func installConfigFlags(conf *config.Config, flags *pflag.FlagSet) {
|
||||
// First handle install flags which are consistent cross-platform
|
||||
if err := installCommonConfigFlags(conf, flags); err != nil {
|
||||
return err
|
||||
}
|
||||
installCommonConfigFlags(conf, flags)
|
||||
|
||||
// Then platform-specific install flags.
|
||||
flags.StringVar(&conf.BridgeConfig.FixedCIDR, "fixed-cidr", "", "IPv4 subnet for fixed IPs")
|
||||
flags.StringVarP(&conf.BridgeConfig.Iface, "bridge", "b", "", "Attach containers to a virtual switch")
|
||||
flags.StringVarP(&conf.SocketGroup, "group", "G", "", "Users or groups that can access the named pipe")
|
||||
return nil
|
||||
}
|
||||
|
||||
// configureCertsDir configures registry.CertsDir() depending on if the daemon
|
||||
|
||||
@@ -18,8 +18,7 @@ func defaultOptions(t *testing.T, configFile string) *daemonOptions {
|
||||
opts := newDaemonOptions(cfg)
|
||||
opts.flags = &pflag.FlagSet{}
|
||||
opts.installFlags(opts.flags)
|
||||
err = installConfigFlags(opts.daemonConfig, opts.flags)
|
||||
assert.NilError(t, err)
|
||||
installConfigFlags(opts.daemonConfig, opts.flags)
|
||||
defaultDaemonConfigFile, err := getDefaultDaemonConfigFile()
|
||||
assert.NilError(t, err)
|
||||
opts.flags.StringVar(&opts.configFile, "config-file", defaultDaemonConfigFile, "")
|
||||
|
||||
@@ -50,9 +50,7 @@ func newDaemonCommand() (*cobra.Command, error) {
|
||||
flags.StringVar(&opts.configFile, "config-file", defaultDaemonConfigFile, "Daemon configuration file")
|
||||
configureCertsDir()
|
||||
opts.installFlags(flags)
|
||||
if err := installConfigFlags(opts.daemonConfig, flags); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
installConfigFlags(opts.daemonConfig, flags)
|
||||
installServiceFlags(flags)
|
||||
|
||||
return cmd, nil
|
||||
|
||||
Reference in New Issue
Block a user