Skip to content

Commit

Permalink
Update compile.go
Browse files Browse the repository at this point in the history
Signed-off-by: Jason Hall <[email protected]>
  • Loading branch information
imjasonh authored Dec 10, 2024
1 parent 5d67d9f commit cd0c82a
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions pkg/compile/compile.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ var rulesWithWarnings = map[string]bool{
}

func Recursive(ctx context.Context, fss []fs.FS) (*yara.Rules, error) {
logger := clog.FromContext(ctx)
yc, err := yara.NewCompiler()
if err != nil {
return nil, fmt.Errorf("yara compiler: %w", err)
Expand Down Expand Up @@ -159,9 +160,9 @@ func Recursive(ctx context.Context, fss []fs.FS) (*yara.Rules, error) {

errors := []string{}
for _, yce := range yc.Errors {
clog.ErrorContext(ctx, "error", slog.String("filename", yce.Filename), slog.Int("line", yce.Line), slog.String("text", yce.Text))
logger.With("line", yce.Line, "filename", yce.Filename).Errorf("error: %s", yce.Text)
if yce.Rule != "" {
clog.ErrorContext(ctx, "defective rule", slog.String("rule", yce.Rule))
logger.With("rule", yce.Rule).Error("defective rule")
}
errors = append(errors, yce.Text)
}
Expand Down Expand Up @@ -190,9 +191,9 @@ func Recursive(ctx context.Context, fss []fs.FS) (*yara.Rules, error) {
continue
}
if !known {
clog.ErrorContext(ctx, "error", slog.String("namespace", r.Namespace()), slog.String("id", id), slog.String("disabled due to unexpected warning", warnings[id]))
logger.With("namespace, r.Namespace(), "id", id).Errorf("disabled due to unexpected warning: %s", warnings[id])

Check failure on line 194 in pkg/compile/compile.go

View workflow job for this annotation

GitHub Actions / check gofmt

missing ',' in argument list

Check failure on line 194 in pkg/compile/compile.go

View workflow job for this annotation

GitHub Actions / check gofmt

string literal not terminated

Check failure on line 194 in pkg/compile/compile.go

View workflow job for this annotation

GitHub Actions / test

missing ',' in argument list

Check failure on line 194 in pkg/compile/compile.go

View workflow job for this annotation

GitHub Actions / test

string literal not terminated

Check failure on line 194 in pkg/compile/compile.go

View workflow job for this annotation

GitHub Actions / golangci-lint

syntax error: unexpected name id in argument list; possibly missing comma or )

Check failure on line 194 in pkg/compile/compile.go

View workflow job for this annotation

GitHub Actions / golangci-lint

newline in string

Check failure on line 194 in pkg/compile/compile.go

View workflow job for this annotation

GitHub Actions / golangci-lint

syntax error: unexpected name id in argument list; possibly missing comma or )

Check failure on line 194 in pkg/compile/compile.go

View workflow job for this annotation

GitHub Actions / golangci-lint

newline in string

Check failure on line 194 in pkg/compile/compile.go

View workflow job for this annotation

GitHub Actions / golangci-lint

missing ',' in argument list (typecheck)

Check failure on line 194 in pkg/compile/compile.go

View workflow job for this annotation

GitHub Actions / check goimports

missing ',' in argument list

Check failure on line 194 in pkg/compile/compile.go

View workflow job for this annotation

GitHub Actions / check goimports

string literal not terminated
} else {
clog.InfoContext(ctx, "info", slog.String("namespace", r.Namespace()), slog.String("id", id), slog.String("disabled due to expected warning", warnings[id]))
logger.With("namespace, r.Namespace(), "id", id).Infof("disabled due to unexpected warning: %s", warnings[id])

Check failure on line 196 in pkg/compile/compile.go

View workflow job for this annotation

GitHub Actions / check gofmt

string literal not terminated

Check failure on line 196 in pkg/compile/compile.go

View workflow job for this annotation

GitHub Actions / test

string literal not terminated

Check failure on line 196 in pkg/compile/compile.go

View workflow job for this annotation

GitHub Actions / golangci-lint

syntax error: unexpected name id in argument list; possibly missing comma or )

Check failure on line 196 in pkg/compile/compile.go

View workflow job for this annotation

GitHub Actions / golangci-lint

newline in string) (typecheck)

Check failure on line 196 in pkg/compile/compile.go

View workflow job for this annotation

GitHub Actions / golangci-lint

syntax error: unexpected name id in argument list; possibly missing comma or )

Check failure on line 196 in pkg/compile/compile.go

View workflow job for this annotation

GitHub Actions / golangci-lint

newline in string (typecheck)

Check failure on line 196 in pkg/compile/compile.go

View workflow job for this annotation

GitHub Actions / check goimports

string literal not terminated
}
r.Disable()
}
Expand Down

0 comments on commit cd0c82a

Please sign in to comment.