Skip to content

Commit e62a8c1

Browse files
jelmeralexeagle
authored andcommitted
golangci-lint: Handle the case when there are no direct sources for e.g. a go_binary
1 parent 80ca8a8 commit e62a8c1

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

lint/golangci-lint.bzl

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,12 @@ def _golangci_lint_aspect_impl(target, ctx):
6969
return []
7070

7171
report, info = report_file(_MNEMONIC, target, ctx)
72-
golangci_lint_action(ctx, ctx.executable._golangci_lint, filter_srcs(ctx.rule), ctx.file._config_file, report, ctx.attr.fail_on_violation)
72+
73+
srcs = filter_srcs(ctx.rule)
74+
if not srcs:
75+
return []
76+
77+
golangci_lint_action(ctx, ctx.executable._golangci_lint, srcs, ctx.file._config_file, report, ctx.attr.fail_on_violation)
7378
return [info]
7479

7580
def golangci_lint_aspect(binary, config):

0 commit comments

Comments
 (0)