simplified trivial expressions (gosimple)

Signed-off-by: Frederic BIDON <fredbi@yahoo.com>
This commit is contained in:
Frederic BIDON
2023-01-05 20:29:20 +01:00
parent 1025431d64
commit 2e5ad85fe0
6 changed files with 5 additions and 17 deletions

View File

@@ -32,7 +32,7 @@ func NewWorkerPool() workerPool {
}
func (wp *workerPool) init(noOfPods ...int) {
if noOfPods != nil && len(noOfPods) > 0 && noOfPods[0] < noOfWorkers {
if len(noOfPods) > 0 && noOfPods[0] < noOfWorkers {
wp.noOfWorkers = noOfPods[0]
}
// init the channels

View File

@@ -34,10 +34,7 @@ func NewExcludeSelector(ns string) *ExcludeSelector {
func (es *ExcludeSelector) GetClusterScope(resource *schema.GroupVersionResource) bool {
// for selector, 'namespace' is in Namespaced scope
if resource.Resource == "namespaces" {
return true
}
return false
return resource.Resource == "namespaces"
}
type IncludeSelector struct {
@@ -50,10 +47,7 @@ func NewIncludeSelector(ns string) *IncludeSelector {
func (is *IncludeSelector) GetClusterScope(resource *schema.GroupVersionResource) bool {
// for selector, 'namespace' is in Namespaced scope
if resource.Resource == "namespaces" {
return true
}
return false
return resource.Resource == "namespaces"
}
func (es *ExcludeSelector) GetNamespacesSelectors(resource *schema.GroupVersionResource) []string {

View File

@@ -26,11 +26,7 @@ func isGitRepoPublic(u string) bool {
// if the status code is 200, our get request is successful.
// It only happens when the repository is public.
if resp.StatusCode == 200 {
return true
}
return false
return resp.StatusCode == nethttp.StatusOK
}
// Check if the GITHUB_TOKEN is present

View File

@@ -87,7 +87,7 @@ func getNumericValueFromEnvVar(envVar string, defaultValue int) int {
return defaultValue
}
func (prettyPrinter *PrettyPrinter) printAttackTracks(opaSessionObj *cautils.OPASessionObj) {
if prettyPrinter.printAttackTree == false || opaSessionObj.ResourceAttackTracks == nil {
if !prettyPrinter.printAttackTree || opaSessionObj.ResourceAttackTracks == nil {
return
}

View File

@@ -114,7 +114,6 @@ func (hp *HtmlPrinter) ActionPrint(opaSessionObj *cautils.OPASessionObj) {
}
func (hp *HtmlPrinter) Score(score float32) {
return
}
func buildResourceTableView(opaSessionObj *cautils.OPASessionObj) ResourceTableView {

View File

@@ -62,7 +62,6 @@ func NewSARIFPrinter() *SARIFPrinter {
}
func (sp *SARIFPrinter) Score(score float32) {
return
}
func (sp *SARIFPrinter) SetWriter(outputFile string) {