* comment fix

* redundancy

* typo nill -> nil

* remove extra newline from log
This commit is contained in:
mmetc 2024-06-13 11:07:44 +02:00 committed by GitHub
parent 4e09ae2182
commit a529e66cd8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 12 additions and 12 deletions

View file

@ -427,7 +427,7 @@ func (cli *cliSupport) writeToZip(zipWriter *zip.Writer, filename string, mtime
}
}
// writeToZip adds a file to the zip archive, from a file, and retains the mtime
// writeFileToZip adds a file to the zip archive, from a file, and retains the mtime
func (cli *cliSupport) writeFileToZip(zw *zip.Writer, filename string, fromFile string) {
mtime := time.Now()

View file

@ -37,7 +37,7 @@ func runParse(input chan types.Event, output chan types.Event, parserCTX parser.
/* parse the log using magic */
parsed, err := parser.Parse(parserCTX, event, nodes)
if err != nil {
log.Errorf("failed parsing : %v\n", err)
log.Errorf("failed parsing: %v", err)
}
elapsed := time.Since(startParsing)
globalParsingHistogram.With(prometheus.Labels{"source": event.Line.Src, "type": event.Line.Module}).Observe(elapsed.Seconds())

View file

@ -294,7 +294,7 @@ func TestWithWrongFlushConfig(t *testing.T) {
config.API.Server.DbConfig.Flush.MaxItems = &maxItems
apiServer, err := NewServer(config.API.Server)
cstest.RequireErrorContains(t, err, "max_items can't be zero or negative number")
cstest.RequireErrorContains(t, err, "max_items can't be zero or negative")
assert.Nil(t, apiServer)
}

View file

@ -22,7 +22,7 @@ func (c *Client) StartFlushScheduler(config *csconfig.FlushDBCfg) (*gocron.Sched
maxAge := ""
if config.MaxItems != nil && *config.MaxItems <= 0 {
return nil, errors.New("max_items can't be zero or negative number")
return nil, errors.New("max_items can't be zero or negative")
}
if config.MaxItems != nil {

View file

@ -109,7 +109,7 @@ func smokeHandler(req *http.Request) *http.Response {
}
}
func TestNillClient(t *testing.T) {
func TestNilClient(t *testing.T) {
defer ShutdownCrowdsecCTI()
if err := InitCrowdsecCTI(ptr.Of(""), nil, nil, nil); !errors.Is(err, cticlient.ErrDisabled) {

View file

@ -59,7 +59,7 @@ func TestBaseDbg(t *testing.T) {
"base_string": "hello world",
"base_int": 42,
"base_float": 42.42,
"nillvar": &teststruct{},
"nilvar": &teststruct{},
"base_struct": struct {
Foo string
Bar int
@ -79,8 +79,8 @@ func TestBaseDbg(t *testing.T) {
//Missing multi parametes function
tests := []ExprDbgTest{
{
Name: "nill deref",
Expr: "Upper('1') == '1' && nillvar.Foo == '42'",
Name: "nil deref",
Expr: "Upper('1') == '1' && nilvar.Foo == '42'",
Env: defaultEnv,
ExpectedFailRuntime: true,
ExpectedOutputs: []OpOutput{
@ -307,8 +307,8 @@ func TestBaseDbg(t *testing.T) {
t.Fatalf("test %s : unexpected compile error : %s", test.Name, err)
}
}
if test.Name == "nill deref" {
test.Env["nillvar"] = nil
if test.Name == "nil deref" {
test.Env["nilvar"] = nil
}
outdbg, ret, err := RunWithDebug(prog, test.Env, logger)
if test.ExpectedFailRuntime {

View file

@ -42,8 +42,8 @@ func SetTargetByName(target string, value string, evt *types.Event) bool {
iter := reflect.ValueOf(evt).Elem()
if (iter == reflect.Value{}) || iter.IsZero() {
log.Tracef("event is nill")
//event is nill
log.Tracef("event is nil")
//event is nil
return false
}
for _, f := range strings.Split(target, ".") {