Skip to content

Commit

Permalink
golangci-lint: Handle the case when there are no direct sources for e…
Browse files Browse the repository at this point in the history
….g. a go_binary
  • Loading branch information
jelmer authored and alexeagle committed Jan 29, 2024
1 parent 80ca8a8 commit e62a8c1
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lint/golangci-lint.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,12 @@ def _golangci_lint_aspect_impl(target, ctx):
return []

report, info = report_file(_MNEMONIC, target, ctx)
golangci_lint_action(ctx, ctx.executable._golangci_lint, filter_srcs(ctx.rule), ctx.file._config_file, report, ctx.attr.fail_on_violation)

srcs = filter_srcs(ctx.rule)
if not srcs:
return []

golangci_lint_action(ctx, ctx.executable._golangci_lint, srcs, ctx.file._config_file, report, ctx.attr.fail_on_violation)
return [info]

def golangci_lint_aspect(binary, config):
Expand Down

0 comments on commit e62a8c1

Please sign in to comment.