bazelbuild / rules_go

Go rules for Bazel
Apache License 2.0
1.36k stars 645 forks source link

Add validation actions for nogo outputs #3695

Closed tingilee closed 1 month ago

tingilee commented 11 months ago

What version of rules_go are you using?

0.40.0

What version of gazelle are you using?

0.28.0

What version of Bazel are you using?

6.3.0rc1

Does this issue reproduce with the latest releases of all the above?

Yes

What operating system and processor architecture are you using?

MacOS M1 Ventura and Linux AMD

Any other potentially useful information about your toolchain?

What did you do?

Set up nogo and ran bazel build //... across the monorepo which contains many static analysis errors.

What did you expect to see?

Should see an exhaustive list of all static analysis errors. This is very important as we're enabling static analysis for the first time across our monorepo.

What did you see instead?

With compilePkg and nogo being coupled, when nogo failed, the compilation also fails. Once compilePkg action fails, the targets that depend on the failed build target never run action of compilePkg. Therefore, bazel build //... only show a subset of errors.

I'd like to propose adding https://bazel.build/extending/rules#validation_actions in the current nogo implementation, and would be happy to contribute upstream. High level proposal is to add validation output here https://github.com/bazelbuild/rules_go/blob/f03a723c49d5ec8afa0f9c74c4c3a705b37e8f40/go/private/actions/compilepkg.bzl#L160 and add validation action runs in compilepkg.bzl.

tingilee commented 11 months ago

@sluongng I found that you've shared design thoughts before: https://github.com/bazelbuild/rules_go/issues/3529#issuecomment-1517707221 What would you recommend here?

sluongng commented 11 months ago

I am in favor of the approach. However I am out of capacity to drive this change. So I would love to review any PR coming my way to make this happen.