From 37c016a5f0b29c0c46d367dc08691ee15bdd4ff9 Mon Sep 17 00:00:00 2001 From: mzack Date: Mon, 19 Sep 2022 08:38:52 +0200 Subject: [PATCH] fixing lint errors --- v2/internal/runner/enumerate.go | 2 +- v2/internal/runner/nucleicloud/cloud.go | 6 +++--- v2/internal/runner/runner.go | 2 +- v2/pkg/core/execute.go | 8 ++++---- v2/pkg/core/workflow_execute.go | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/v2/internal/runner/enumerate.go b/v2/internal/runner/enumerate.go index 93f20357..da9a77cb 100644 --- a/v2/internal/runner/enumerate.go +++ b/v2/internal/runner/enumerate.go @@ -51,7 +51,7 @@ func (r *Runner) runCloudEnumeration(store *loader.Store) (*atomic.Bool, error) time.Sleep(3 * time.Second) err = client.GetResults(taskID, func(re *output.ResultEvent) { - results.CAS(false, true) + results.CompareAndSwap(false, true) if outputErr := r.output.Write(re); outputErr != nil { gologger.Warning().Msgf("Could not write output: %s", err) diff --git a/v2/internal/runner/nucleicloud/cloud.go b/v2/internal/runner/nucleicloud/cloud.go index 89379a35..533ab7bf 100644 --- a/v2/internal/runner/nucleicloud/cloud.go +++ b/v2/internal/runner/nucleicloud/cloud.go @@ -3,7 +3,7 @@ package nucleicloud import ( "bytes" "fmt" - "io/ioutil" + "io" "net/http" "strings" "time" @@ -56,7 +56,7 @@ func (c *Client) AddScan(req *AddScanRequest) (string, error) { return "", errors.Wrap(err, "could not do add scan request") } if resp.StatusCode != 200 { - data, _ := ioutil.ReadAll(resp.Body) + data, _ := io.ReadAll(resp.Body) resp.Body.Close() return "", errors.Errorf("could not do request %d: %s", resp.StatusCode, string(data)) } @@ -86,7 +86,7 @@ func (c *Client) GetResults(ID string, callback func(*output.ResultEvent)) error return errors.Wrap(err, "could not do ger result request") } if resp.StatusCode != 200 { - data, _ := ioutil.ReadAll(resp.Body) + data, _ := io.ReadAll(resp.Body) resp.Body.Close() return errors.Errorf("could not do request %d: %s", resp.StatusCode, string(data)) } diff --git a/v2/internal/runner/runner.go b/v2/internal/runner/runner.go index b52d58cf..0a18676d 100644 --- a/v2/internal/runner/runner.go +++ b/v2/internal/runner/runner.go @@ -413,7 +413,7 @@ func (r *Runner) RunEnumeration() error { if r.interactsh != nil { matched := r.interactsh.Close() if matched { - results.CAS(false, true) + results.CompareAndSwap(false, true) } } r.progress.Stop() diff --git a/v2/pkg/core/execute.go b/v2/pkg/core/execute.go index 78da4155..434a4fff 100644 --- a/v2/pkg/core/execute.go +++ b/v2/pkg/core/execute.go @@ -63,7 +63,7 @@ func (e *Engine) executeSelfContainedTemplateWithInput(template *templates.Templ if err != nil { gologger.Warning().Msgf("[%s] Could not execute step: %s\n", e.executerOpts.Colorizer.BrightBlue(template.ID), err) } - results.CAS(false, match) + results.CompareAndSwap(false, match) } // executeModelWithInput executes a type of template with input @@ -144,7 +144,7 @@ func (e *Engine) executeModelWithInput(templateType types.ProtocolType, template if err != nil { gologger.Warning().Msgf("[%s] Could not execute step: %s\n", e.executerOpts.Colorizer.BrightBlue(template.ID), err) } - results.CAS(false, match) + results.CompareAndSwap(false, match) }(index, skip, scannedValue) index++ @@ -209,7 +209,7 @@ func (e *Engine) executeModelWithInputAndResult(templateType types.ProtocolType, if err != nil { gologger.Warning().Msgf("[%s] Could not execute step: %s\n", e.executerOpts.Colorizer.BrightBlue(template.ID), err) } - results.CAS(false, match) + results.CompareAndSwap(false, match) }(scannedValue) }) wg.WaitGroup.Wait() @@ -244,7 +244,7 @@ func (e *ChildExecuter) Execute(template *templates.Template, URL string) { if err != nil { gologger.Warning().Msgf("[%s] Could not execute step: %s\n", e.e.executerOpts.Colorizer.BrightBlue(template.ID), err) } - e.results.CAS(false, match) + e.results.CompareAndSwap(false, match) wg.Done() }(template) } diff --git a/v2/pkg/core/workflow_execute.go b/v2/pkg/core/workflow_execute.go index 015a7482..4acfd5af 100644 --- a/v2/pkg/core/workflow_execute.go +++ b/v2/pkg/core/workflow_execute.go @@ -71,7 +71,7 @@ func (e *Engine) runWorkflowStep(template *workflows.WorkflowTemplate, input str } } if len(template.Subtemplates) == 0 { - results.CAS(false, firstMatched) + results.CompareAndSwap(false, firstMatched) } if len(template.Matchers) > 0 { for _, executer := range template.Executers {