Merge pull request #3844 from MaXinjian/0428

Fix small golint warning
This commit is contained in:
Kubernetes Prow Robot
2021-04-30 14:13:58 -07:00
committed by GitHub
11 changed files with 22 additions and 33 deletions

View File

@@ -102,10 +102,9 @@ func (r *AnnotateRunner) ExecuteCmd(w io.Writer, pkgPath string) error {
// return err if there is only package
if !r.RecurseSubPackages {
return err
} else {
// print error message and continue if there are multiple packages to annotate
fmt.Fprintf(w, "%s\n", err.Error())
}
// print error message and continue if there are multiple packages to annotate
fmt.Fprintf(w, "%s\n", err.Error())
} else {
fmt.Fprint(w, "added annotations in the package\n")
}

View File

@@ -138,10 +138,9 @@ func (r *CatRunner) ExecuteCmd(w io.Writer, pkgPath string) error {
// return err if there is only package
if !r.RecurseSubPackages {
return err
} else {
// print error message and continue if there are multiple packages to annotate
fmt.Fprintf(w, "%s in package %q\n", err.Error(), pkgPath)
}
// print error message and continue if there are multiple packages to annotate
fmt.Fprintf(w, "%s in package %q\n", err.Error(), pkgPath)
}
fmt.Fprint(w, out.String())
if out.String() != "" {

View File

@@ -196,10 +196,9 @@ func (r *CreateSetterRunner) ExecuteCmd(w io.Writer, pkgPath string) error {
// return err if RecurseSubPackages is false
if !r.CreateSetter.RecurseSubPackages {
return err
} else {
// print error message and continue if RecurseSubPackages is true
fmt.Fprintf(w, "%s\n", err.Error())
}
// print error message and continue if RecurseSubPackages is true
fmt.Fprintf(w, "%s\n", err.Error())
} else {
fmt.Fprintf(w, "created setter %q\n", r.CreateSetter.Name)
}

View File

@@ -88,10 +88,9 @@ func (r *CreateSubstitutionRunner) ExecuteCmd(w io.Writer, pkgPath string) error
// return err if RecurseSubPackages is false
if !r.CreateSubstitution.RecurseSubPackages {
return err
} else {
// print error message and continue if RecurseSubPackages is true
fmt.Fprintf(w, "%s\n", err.Error())
}
// print error message and continue if RecurseSubPackages is true
fmt.Fprintf(w, "%s\n", err.Error())
} else {
fmt.Fprintf(w, "created substitution %q\n", r.CreateSubstitution.Name)
}

View File

@@ -92,10 +92,9 @@ func (r *DeleteSetterRunner) ExecuteCmd(w io.Writer, pkgPath string) error {
// return err if RecurseSubPackages is false
if !r.DeleteSetter.RecurseSubPackages {
return err
} else {
// print error message and continue if RecurseSubPackages is true
fmt.Fprintf(w, "%s\n", err.Error())
}
// print error message and continue if RecurseSubPackages is true
fmt.Fprintf(w, "%s\n", err.Error())
} else {
fmt.Fprintf(w, "deleted setter %q\n", r.DeleteSetter.Name)
}

View File

@@ -88,10 +88,9 @@ func (r *DeleteSubstitutionRunner) ExecuteCmd(w io.Writer, pkgPath string) error
// return err if RecurseSubPackages is false
if !r.DeleteSubstitution.RecurseSubPackages {
return err
} else {
// print error message and continue if RecurseSubPackages is true
fmt.Fprintf(w, "%s\n", err.Error())
}
// print error message and continue if RecurseSubPackages is true
fmt.Fprintf(w, "%s\n", err.Error())
} else {
fmt.Fprintf(w, "deleted substitution %q\n", r.DeleteSubstitution.Name)
}

View File

@@ -128,10 +128,9 @@ func (r *SetRunner) ExecuteCmd(w io.Writer, pkgPath string) error {
// return err if RecurseSubPackages is false
if !r.Set.RecurseSubPackages {
return err
} else {
// print error message and continue if RecurseSubPackages is true
fmt.Fprintf(w, "%s\n", err.Error())
}
// print error message and continue if RecurseSubPackages is true
fmt.Fprintf(w, "%s\n", err.Error())
} else {
fmt.Fprintf(w, "set %d field(s) of setter %q to value %q\n", count, r.Set.Name, r.Set.Value)
}

View File

@@ -81,10 +81,9 @@ func (r *CountRunner) ExecuteCmd(w io.Writer, pkgPath string) error {
// return err if there is only package
if !r.RecurseSubPackages {
return err
} else {
// print error message and continue if there are multiple packages to annotate
fmt.Fprintf(w, "%s\n", err.Error())
}
// print error message and continue if there are multiple packages to annotate
fmt.Fprintf(w, "%s\n", err.Error())
}
return nil
}

View File

@@ -108,10 +108,9 @@ func (r *FmtRunner) ExecuteCmd(w io.Writer, pkgPath string) error {
// return err if RecurseSubPackages is false
if !r.RecurseSubPackages {
return err
} else {
// print error message and continue if RecurseSubPackages is true
fmt.Fprintf(w, "%s\n", err.Error())
}
// print error message and continue if RecurseSubPackages is true
fmt.Fprintf(w, "%s\n", err.Error())
} else {
fmt.Fprint(w, "formatted resource files in the package\n")
}

View File

@@ -155,10 +155,9 @@ func (r *GrepRunner) ExecuteCmd(w io.Writer, pkgPath string) error {
// return err if there is only package
if !r.RecurseSubPackages {
return err
} else {
// print error message and continue if there are multiple packages to annotate
fmt.Fprintf(w, "%s\n", err.Error())
}
// print error message and continue if there are multiple packages to annotate
fmt.Fprintf(w, "%s\n", err.Error())
}
fmt.Fprint(w, out.String())
if out.String() != "" {

View File

@@ -80,10 +80,9 @@ func (p *plugin) Config(
func (p *plugin) Transform(m resmap.ResMap) error {
if p.loadedPatch == nil {
return p.transformJson6902(m, p.decodedPatch)
} else {
// The patch was a strategic merge patch
return p.transformStrategicMerge(m, p.loadedPatch)
}
// The patch was a strategic merge patch
return p.transformStrategicMerge(m, p.loadedPatch)
}
// transformStrategicMerge applies the provided strategic merge patch