Merge pull request #112024 from cndoit18/remove-redundant-judgment

style: remove redundant judgment
This commit is contained in:
Kubernetes Prow Robot
2022-08-25 07:28:18 -07:00
committed by GitHub
26 changed files with 26 additions and 112 deletions

View File

@@ -87,11 +87,7 @@ func validateCSR(obj *certificates.CertificateSigningRequest) error {
return err
}
// check that the signature is valid
err = csr.CheckSignature()
if err != nil {
return err
}
return nil
return csr.CheckSignature()
}
func validateCertificate(pemData []byte) error {

View File

@@ -36,9 +36,5 @@ var SortingDeletionAgeRatio = metrics.NewHistogram(
// Register registers ReplicaSet controller metrics.
func Register(registrationFunc func(metrics.Registerable) error) error {
err := registrationFunc(SortingDeletionAgeRatio)
if err != nil {
return err
}
return nil
return registrationFunc(SortingDeletionAgeRatio)
}

View File

@@ -138,10 +138,7 @@ func (o *ConvertOptions) Complete(f cmdutil.Factory, cmd *cobra.Command) (err er
// build the printer
o.Printer, err = o.PrintFlags.ToPrinter()
if err != nil {
return err
}
return nil
return err
}
// RunConvert implements the generic Convert command

View File

@@ -214,10 +214,7 @@ func (m *Stub) Register(kubeletEndpoint, resourceName string, pluginSockDir stri
}
_, err = client.Register(context.Background(), reqt)
if err != nil {
return err
}
return nil
return err
}
// GetDevicePluginOptions returns DevicePluginOptions settings for the device plugin.

View File

@@ -77,9 +77,5 @@ func (c *ObjectCache) Get(key string) (interface{}, error) {
// Add adds objectEntry by using a unique string as the key.
func (c *ObjectCache) Add(key string, obj interface{}) error {
err := c.cache.Add(objectEntry{key: key, obj: obj})
if err != nil {
return err
}
return nil
return c.cache.Add(objectEntry{key: key, obj: obj})
}

View File

@@ -524,11 +524,7 @@ func (ed *emptyDir) teardownDefault(dir string) error {
}
// Renaming the directory is not required anymore because the operation executor
// now handles duplicate operations on the same volume
err = os.RemoveAll(dir)
if err != nil {
return err
}
return nil
return os.RemoveAll(dir)
}
func (ed *emptyDir) teardownTmpfsOrHugetlbfs(dir string) error {