nogo: ignore generated source files (#3216)
Under GoCompilePkg actions, there are several ways that source files
could have been modified / generated that is out of end users
control:
- go_test would generate an '_empty.go' file for the missing
internal/external package to compile it.
- coverage instrumentation would rewrite test source files with a
wrapper source file that collects coverage data into a determined
variable.
- CGO usage would transform the original source files into several
output Go and C source files with `go tool cgo ...`
Implement a mechanism to ignore the generated source files for the first
2 cases and instruct static analyzers to run over the original source
files wherever applicable. This provides a better default for rules_go
users as static analysis errors over these generated files are outside
of their control and thus, could not be fixed.
Add a note regarding the CGO case for future investigations.
6 files changed