feat: Errorf usage

Signed-off-by: haoyun <yun.hao@daocloud.io>
This commit is contained in:
haoyun
2021-12-13 14:31:53 +08:00
parent a04656c1dd
commit c0d07094be
30 changed files with 80 additions and 80 deletions

View File

@@ -394,7 +394,7 @@ func ValidatePluginConfig(ctx context.Context, c *PluginConfig) error {
useConfigPath := c.Registry.ConfigPath != ""
if len(c.Registry.Mirrors) > 0 {
if useConfigPath {
return errors.Errorf("`mirrors` cannot be set when `config_path` is provided")
return errors.New("`mirrors` cannot be set when `config_path` is provided")
}
log.G(ctx).Warning("`mirrors` is deprecated, please use `config_path` instead")
}
@@ -407,7 +407,7 @@ func ValidatePluginConfig(ctx context.Context, c *PluginConfig) error {
}
if hasDeprecatedTLS {
if useConfigPath {
return errors.Errorf("`configs.tls` cannot be set when `config_path` is provided")
return errors.New("`configs.tls` cannot be set when `config_path` is provided")
}
log.G(ctx).Warning("`configs.tls` is deprecated, please use `config_path` instead")
}

View File

@@ -481,7 +481,7 @@ func WithResources(resources *runtime.LinuxContainerResources, tolerateMissingHu
}
} else {
if !tolerateMissingHugetlbController {
return errors.Errorf("huge pages limits are specified but hugetlb cgroup controller is missing. " +
return errors.New("huge pages limits are specified but hugetlb cgroup controller is missing. " +
"Please set tolerate_missing_hugetlb_controller to `true` to ignore this error")
}
logrus.Warn("hugetlb cgroup controller is absent. skipping huge pages limits")

View File

@@ -272,7 +272,7 @@ func (em *eventMonitor) start() <-chan error {
case err := <-em.errCh:
// Close errCh in defer directly if there is no error.
if err != nil {
logrus.WithError(err).Errorf("Failed to handle event stream")
logrus.WithError(err).Error("Failed to handle event stream")
errCh <- err
}
return