mirror of
https://github.com/projectdiscovery/nuclei.git
synced 2026-02-12 05:23:12 +08:00
Lint + test fixes after utils dep update (#6393)
* fix: remove undefined errorutil.ShowStackTrace * feat: add make lint support and integrate with test * refactor: migrate errorutil to errkit across codebase - Replace deprecated errorutil with modern errkit - Convert error declarations from var to func for better compatibility - Fix all SA1019 deprecation warnings - Maintain error chain support and stack traces * fix: improve DNS test reliability using Google DNS - Configure test to use Google DNS (8.8.8.8) for stability - Fix nil pointer issue in DNS client initialization - Keep production defaults unchanged * fixing logic * removing unwanted branches in makefile --------- Co-authored-by: Mzack9999 <mzack9999@protonmail.com>
This commit is contained in:
@@ -33,7 +33,6 @@ import (
|
||||
"github.com/projectdiscovery/nuclei/v3/pkg/types"
|
||||
contextutil "github.com/projectdiscovery/utils/context"
|
||||
"github.com/projectdiscovery/utils/errkit"
|
||||
errorutil "github.com/projectdiscovery/utils/errors"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -114,7 +113,7 @@ func (request *Request) Compile(options *protocols.ExecutorOptions) error {
|
||||
if options.Options.Validate {
|
||||
options.Logger.Error().Msgf("%s <- %s", errMsg, err)
|
||||
} else {
|
||||
return errorutil.NewWithErr(err).Msgf(errMsg)
|
||||
return errkit.Append(errkit.New(errMsg), err)
|
||||
}
|
||||
} else {
|
||||
request.gozero = engine
|
||||
@@ -154,7 +153,7 @@ func (request *Request) Compile(options *protocols.ExecutorOptions) error {
|
||||
if request.PreCondition != "" {
|
||||
preConditionCompiled, err := compiler.SourceAutoMode(request.PreCondition, false)
|
||||
if err != nil {
|
||||
return errorutil.NewWithTag(request.TemplateID, "could not compile pre-condition: %s", err)
|
||||
return errkit.New(fmt.Sprintf("%s: could not compile pre-condition: %s", request.TemplateID, err)).Build()
|
||||
}
|
||||
request.preConditionCompiled = preConditionCompiled
|
||||
}
|
||||
@@ -231,7 +230,7 @@ func (request *Request) ExecuteWithResults(input *contextargs.Context, dynamicVa
|
||||
Context: input.Context(),
|
||||
})
|
||||
if err != nil {
|
||||
return errorutil.NewWithTag(request.TemplateID, "could not execute pre-condition: %s", err)
|
||||
return errkit.New(fmt.Sprintf("%s: could not execute pre-condition: %s", request.TemplateID, err)).Build()
|
||||
}
|
||||
if !result.GetSuccess() || types.ToString(result["error"]) != "" {
|
||||
gologger.Warning().Msgf("[%s] Precondition for request %s was not satisfied\n", request.TemplateID, request.PreCondition)
|
||||
|
||||
Reference in New Issue
Block a user