removing err

This commit is contained in:
mzack 2024-03-15 13:36:57 +01:00
parent d988de45f6
commit 2dd8c8c5ae
9 changed files with 10 additions and 24 deletions

View File

@ -100,8 +100,6 @@ func executeNucleiAsLibrary(templatePath, templateURL string) ([]string, error)
ratelimiter := ratelimit.New(context.Background(), 150, time.Second)
defer ratelimiter.Stop()
parser, _ := templates.NewParser()
executerOpts := protocols.ExecutorOptions{
Output: outputWriter,
Options: defaultOpts,
@ -113,7 +111,7 @@ func executeNucleiAsLibrary(templatePath, templateURL string) ([]string, error)
HostErrorsCache: cache,
Colorizer: aurora.NewAurora(true),
ResumeCfg: types.NewResumeCfg(),
Parser: parser,
Parser: templates.NewParser(),
}
engine := core.New(defaultOpts)
engine.SetExecuterOptions(executerOpts)

View File

@ -150,10 +150,7 @@ func New(options *types.Options) (*Runner, error) {
}
}
parser, err := templates.NewParser()
if err != nil {
return nil, err
}
parser := templates.NewParser()
if options.Validate {
parser.ShouldValidate = true

View File

@ -114,11 +114,7 @@ func (e *NucleiEngine) init() error {
e.httpClient = httpclient
}
if parser, err := templates.NewParser(); err != nil {
return err
} else {
e.parser = parser
}
e.parser = templates.NewParser()
_ = protocolstate.Init(e.opts)
_ = protocolinit.Init(e.opts)

View File

@ -31,7 +31,6 @@ func setup() {
options := testutils.DefaultOptions
testutils.Init(options)
progressImpl, _ := progress.NewStatsTicker(0, false, false, false, 0)
parser, _ = templates.NewParser()
executerOpts = protocols.ExecutorOptions{
Output: testutils.NewMockOutputWriter(options.OmitTemplate),
@ -42,7 +41,7 @@ func setup() {
Browser: nil,
Catalog: disk.NewCatalog(config.DefaultConfig.TemplatesDirectory),
RateLimiter: ratelimit.New(context.Background(), uint(options.RateLimit), time.Second),
Parser: parser,
Parser: templates.NewParser(),
}
workflowLoader, err := workflow.NewLoader(&executerOpts)
if err != nil {

View File

@ -37,7 +37,6 @@ func setup() {
options := testutils.DefaultOptions
testutils.Init(options)
progressImpl, _ := progress.NewStatsTicker(0, false, false, false, 0)
parser, _ := templates.NewParser()
executerOpts = protocols.ExecutorOptions{
Output: testutils.NewMockOutputWriter(options.OmitTemplate),
@ -48,7 +47,7 @@ func setup() {
Browser: nil,
Catalog: disk.NewCatalog(config.DefaultConfig.TemplatesDirectory),
RateLimiter: ratelimit.New(context.Background(), uint(options.RateLimit), time.Second),
Parser: parser,
Parser: templates.NewParser(),
}
workflowLoader, err := workflow.NewLoader(&executerOpts)
if err != nil {

View File

@ -24,13 +24,13 @@ type Parser struct {
compiledTemplatesCache *Cache
}
func NewParser() (*Parser, error) {
func NewParser() *Parser {
p := &Parser{
parsedTemplatesCache: NewCache(),
compiledTemplatesCache: NewCache(),
}
return p, nil
return p
}
// LoadTemplate returns true if the template is valid and matches the filtering criteria.

View File

@ -14,8 +14,7 @@ import (
func TestLoadTemplate(t *testing.T) {
catalog := disk.NewCatalog("")
p, err := NewParser()
require.Nil(t, err)
p := NewParser()
tt := []struct {
name string

View File

@ -25,7 +25,6 @@ func setup() {
options := testutils.DefaultOptions
testutils.Init(options)
progressImpl, _ := progress.NewStatsTicker(0, false, false, false, 0)
parser, _ := templates.NewParser()
executerOpts = protocols.ExecutorOptions{
Output: testutils.NewMockOutputWriter(options.OmitTemplate),
@ -36,7 +35,7 @@ func setup() {
Browser: nil,
Catalog: disk.NewCatalog(config.DefaultConfig.TemplatesDirectory),
RateLimiter: ratelimit.New(context.Background(), uint(options.RateLimit), time.Second),
Parser: parser,
Parser: templates.NewParser(),
}
workflowLoader, err := workflow.NewLoader(&executerOpts)
if err != nil {

View File

@ -25,7 +25,6 @@ func setup() {
options := testutils.DefaultOptions
testutils.Init(options)
progressImpl, _ := progress.NewStatsTicker(0, false, false, false, 0)
parser, _ := templates.NewParser()
executerOpts = protocols.ExecutorOptions{
Output: testutils.NewMockOutputWriter(options.OmitTemplate),
@ -36,7 +35,7 @@ func setup() {
Browser: nil,
Catalog: disk.NewCatalog(config.DefaultConfig.TemplatesDirectory),
RateLimiter: ratelimit.New(context.Background(), uint(options.RateLimit), time.Second),
Parser: parser,
Parser: templates.NewParser(),
}
workflowLoader, err := workflow.NewLoader(&executerOpts)
if err != nil {