Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cover: use Z instead of underscore for variable name separator (#2995)
During the invocation of `bazel coverage`, rules_go will rewrite the source fils using `go tool cover -var ...` so that the variable can be extracted for coverage statistic after test execution. For more information on this, review the relevant Official Go Team's blog post (1) The variable used by rules_go is following the `Cover_snake_case` naming convention, which is natural to starlark and python, but not Golang. For this reason, some static analysis could get triggered by the usage of snake case naming variable while running over coverage source code. The correct solution for this problem should be to make rules_go's static analysis framework `nogo` to NOT run on the generated source code and instead only run on the original source code. However, replacing underscore separators with character `Z` is a relatively cheap fix that would let us unblock static analysis run during `bazel coverage` for now. See discussion in (2) for more details. (1): https://go.dev/blog/cover (2): #2984
- Loading branch information