mirror of
https://github.com/crowdsecurity/crowdsec.git
synced 2025-05-11 04:15:54 +02:00
light pkg/parser cleanup (#2279)
* pkg/parser: clean up imports * remove duplicate import * simplify boolean expression * don't check length before range * if..else if.. -> switch/case * errors.Wrap -> fmt.Errorf * typo, lint * redundant break
This commit is contained in:
parent
76429f033a
commit
b9a3acb03f
13 changed files with 108 additions and 115 deletions
|
@ -7,12 +7,13 @@ import (
|
|||
"sort"
|
||||
"strings"
|
||||
|
||||
log "github.com/sirupsen/logrus"
|
||||
|
||||
"github.com/crowdsecurity/grokky"
|
||||
|
||||
"github.com/crowdsecurity/crowdsec/pkg/csconfig"
|
||||
"github.com/crowdsecurity/crowdsec/pkg/cwhub"
|
||||
"github.com/crowdsecurity/crowdsec/pkg/fflag"
|
||||
|
||||
"github.com/crowdsecurity/grokky"
|
||||
log "github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
type UnixParserCtx struct {
|
||||
|
@ -117,7 +118,7 @@ func LoadParsers(cConfig *csconfig.Config, parsers *Parsers) (*Parsers, error) {
|
|||
|
||||
parsers.EnricherCtx, err = Loadplugin(cConfig.Crowdsec.DataDir)
|
||||
if err != nil {
|
||||
return parsers, fmt.Errorf("Failed to load enrich plugin : %v", err)
|
||||
return parsers, fmt.Errorf("failed to load enrich plugin : %v", err)
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -135,8 +136,8 @@ func LoadParsers(cConfig *csconfig.Config, parsers *Parsers) (*Parsers, error) {
|
|||
log.Infof("Loading postoverflow parsers")
|
||||
parsers.Povfwnodes, err = LoadStages(parsers.PovfwStageFiles, parsers.Povfwctx, parsers.EnricherCtx)
|
||||
} else {
|
||||
parsers.Povfwnodes = []Node{}
|
||||
log.Infof("No postoverflow parsers to load")
|
||||
parsers.Povfwnodes = []Node{}
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue