-
-
Notifications
You must be signed in to change notification settings - Fork 668
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
nogo: ignore generated source files #3216
Conversation
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
1012079
to
9e4f252
Compare
@@ -295,6 +295,7 @@ tasks: | |||
- "-//tests/core/go_test:data_test" | |||
- "-//tests/core/go_test:pwd_test" | |||
- "-//tests/core/nogo/coverage:coverage_test" | |||
- "-//tests/core/nogo/coverage:gen_code_test" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See #2518 for details
The reason why I skip on doing CGO is:
Would love if somebody could address that in the future as I believe it would make the code a lot 'cleaner'. |
Not dealing with CGo code until there is a clear need to do so seems fine to me. |
@fmeum I applied your comment suggestion but Google's CLA does not seems to have the email that is used in the commit trailer:
If you don't want to sign the CLA w. that email, I can either do an amend to change to an email of your choice or to remove the Co-Author trailer entirely. Let me know your preference. |
@aiuto Sorry to bother you with this, but is there a way to sign the Google CLA for a single GitHub account with two Google accounts? My last name changed and I now maintain two distinct Google accounts linked to my old and new name. I have signed the CLA with the old one and now can't add my new email to it because myaccount.google.com/alternateemail doesn't allow entering the address of another Google account. Do you see a way to unblock my commits under the new name? |
@sluongng Seems rather difficult to do, so please go ahead and squash away my author info. |
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.
de2e090
to
1ce1832
Compare
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [io_bazel_rules_go](https://togithub.com/bazelbuild/rules_go) | http_archive | minor | `v0.33.0` -> `v0.34.0` | --- ### Release Notes <details> <summary>bazelbuild/rules_go</summary> ### [`v0.34.0`](https://togithub.com/bazelbuild/rules_go/releases/tag/v0.34.0) [Compare Source](https://togithub.com/bazelbuild/rules_go/compare/v0.33.0...v0.34.0) #### What's Changed - releaser: fix scrubbing timestamp from patch files by [@​sluongng](https://togithub.com/sluongng) in [https://github.com/bazelbuild/rules_go/pull/3180](https://togithub.com/bazelbuild/rules_go/pull/3180) - Replace Starlark JSON parser with json.decode by [@​fmeum](https://togithub.com/fmeum) in [https://github.com/bazelbuild/rules_go/pull/3184](https://togithub.com/bazelbuild/rules_go/pull/3184) - gopackagesdriver: separates "s" files in pkg info by [@​iamricard](https://togithub.com/iamricard) in [https://github.com/bazelbuild/rules_go/pull/3165](https://togithub.com/bazelbuild/rules_go/pull/3165) - Refactor away references to @​io_bazel_rules_go by [@​fmeum](https://togithub.com/fmeum) in [https://github.com/bazelbuild/rules_go/pull/3185](https://togithub.com/bazelbuild/rules_go/pull/3185) - Do not print to stderr if cgo linking succeeds after retry by [@​fmeum](https://togithub.com/fmeum) in [https://github.com/bazelbuild/rules_go/pull/3187](https://togithub.com/bazelbuild/rules_go/pull/3187) - Use param files with go-protoc by [@​fmeum](https://togithub.com/fmeum) in [https://github.com/bazelbuild/rules_go/pull/3190](https://togithub.com/bazelbuild/rules_go/pull/3190) - Don't include non-executable go_binary in dependent's runfiles by [@​fmeum](https://togithub.com/fmeum) in [https://github.com/bazelbuild/rules_go/pull/3151](https://togithub.com/bazelbuild/rules_go/pull/3151) - Link in native libraries of transitive dependencies in archive mode by [@​fmeum](https://togithub.com/fmeum) in [https://github.com/bazelbuild/rules_go/pull/3186](https://togithub.com/bazelbuild/rules_go/pull/3186) - runfiles: remove deprecated api by [@​sluongng](https://togithub.com/sluongng) in [https://github.com/bazelbuild/rules_go/pull/3198](https://togithub.com/bazelbuild/rules_go/pull/3198) - Fix failing open hermeticity test by [@​fmeum](https://togithub.com/fmeum) in [https://github.com/bazelbuild/rules_go/pull/3206](https://togithub.com/bazelbuild/rules_go/pull/3206) - Fix go_googleapis Gazelle patch by [@​nickgooding](https://togithub.com/nickgooding) in [https://github.com/bazelbuild/rules_go/pull/3193](https://togithub.com/bazelbuild/rules_go/pull/3193) - Exclude unsupported C/C++ features by [@​fmeum](https://togithub.com/fmeum) in [https://github.com/bazelbuild/rules_go/pull/3189](https://togithub.com/bazelbuild/rules_go/pull/3189) - Allow gomock to take Bazel common attributes by [@​linzhp](https://togithub.com/linzhp) in [https://github.com/bazelbuild/rules_go/pull/3207](https://togithub.com/bazelbuild/rules_go/pull/3207) - Transition on edges not self by [@​illicitonion](https://togithub.com/illicitonion) in [https://github.com/bazelbuild/rules_go/pull/3116](https://togithub.com/bazelbuild/rules_go/pull/3116) - Include go_transition_test in bazel aspect by [@​ian-h-chamberlain](https://togithub.com/ian-h-chamberlain) in [https://github.com/bazelbuild/rules_go/pull/3160](https://togithub.com/bazelbuild/rules_go/pull/3160) - Add an example for go_download_sdk.sdks by [@​fishy](https://togithub.com/fishy) in [https://github.com/bazelbuild/rules_go/pull/3139](https://togithub.com/bazelbuild/rules_go/pull/3139) - tests: nogo over generated code by [@​sluongng](https://togithub.com/sluongng) in [https://github.com/bazelbuild/rules_go/pull/3214](https://togithub.com/bazelbuild/rules_go/pull/3214) - test nogo/coverage: test generated code by [@​sluongng](https://togithub.com/sluongng) in [https://github.com/bazelbuild/rules_go/pull/3213](https://togithub.com/bazelbuild/rules_go/pull/3213) - Remove references to go_transition_test by [@​linzhp](https://togithub.com/linzhp) in [https://github.com/bazelbuild/rules_go/pull/3215](https://togithub.com/bazelbuild/rules_go/pull/3215) - Basic bzlmod setup by [@​fmeum](https://togithub.com/fmeum) in [https://github.com/bazelbuild/rules_go/pull/3047](https://togithub.com/bazelbuild/rules_go/pull/3047) - Run BCR tests against Bazel 6.0.0-pre.20220608.2 by [@​fmeum](https://togithub.com/fmeum) in [https://github.com/bazelbuild/rules_go/pull/3223](https://togithub.com/bazelbuild/rules_go/pull/3223) - Use repo-relative labels in MODULE.bazel by [@​fmeum](https://togithub.com/fmeum) in [https://github.com/bazelbuild/rules_go/pull/3226](https://togithub.com/bazelbuild/rules_go/pull/3226) - upkeep: upgrade to go 1.18.3 and gazelle v0.26.0 by [@​sluongng](https://togithub.com/sluongng) in [https://github.com/bazelbuild/rules_go/pull/3220](https://togithub.com/bazelbuild/rules_go/pull/3220) - nogo: ignore generated source files by [@​sluongng](https://togithub.com/sluongng) in [https://github.com/bazelbuild/rules_go/pull/3216](https://togithub.com/bazelbuild/rules_go/pull/3216) - asm: Pass package path with -p by [@​fmeum](https://togithub.com/fmeum) in [https://github.com/bazelbuild/rules_go/pull/3231](https://togithub.com/bazelbuild/rules_go/pull/3231) - bzlmod: Add support for gomock by [@​fmeum](https://togithub.com/fmeum) in [https://github.com/bazelbuild/rules_go/pull/3232](https://togithub.com/bazelbuild/rules_go/pull/3232) - test cgo: ensure helper script works by [@​sluongng](https://togithub.com/sluongng) in [https://github.com/bazelbuild/rules_go/pull/3236](https://togithub.com/bazelbuild/rules_go/pull/3236) - Fix //tests/legacy/examples/cgo:cgo_lib_test on M1 Macs by [@​fmeum](https://togithub.com/fmeum) in [https://github.com/bazelbuild/rules_go/pull/3237](https://togithub.com/bazelbuild/rules_go/pull/3237) - gopackagesdriver: Descend into go_proto_compiler's deps by [@​fmeum](https://togithub.com/fmeum) in [https://github.com/bazelbuild/rules_go/pull/3240](https://togithub.com/bazelbuild/rules_go/pull/3240) - new_library: remove unused resolver by [@​sluongng](https://togithub.com/sluongng) in [https://github.com/bazelbuild/rules_go/pull/3219](https://togithub.com/bazelbuild/rules_go/pull/3219) - nogo: instantiate type info for generic types when running under Go >=1.18 by [@​farhaven](https://togithub.com/farhaven) in [https://github.com/bazelbuild/rules_go/pull/3212](https://togithub.com/bazelbuild/rules_go/pull/3212) #### New Contributors - [@​iamricard](https://togithub.com/iamricard) made their first contribution in [https://github.com/bazelbuild/rules_go/pull/3165](https://togithub.com/bazelbuild/rules_go/pull/3165) - [@​ian-h-chamberlain](https://togithub.com/ian-h-chamberlain) made their first contribution in [https://github.com/bazelbuild/rules_go/pull/3160](https://togithub.com/bazelbuild/rules_go/pull/3160) - [@​fishy](https://togithub.com/fishy) made their first contribution in [https://github.com/bazelbuild/rules_go/pull/3139](https://togithub.com/bazelbuild/rules_go/pull/3139) - [@​farhaven](https://togithub.com/farhaven) made their first contribution in [https://github.com/bazelbuild/rules_go/pull/3212](https://togithub.com/bazelbuild/rules_go/pull/3212) **Full Changelog**: bazel-contrib/rules_go@v0.33.0...v0.34.0 #### `WORKSPACE` code load("@​bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") http_archive( name = "io_bazel_rules_go", sha256 = "16e9fca53ed6bd4ff4ad76facc9b7b651a89db1689a2877d6fd7b82aa824e366", urls = [ "https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.34.0/rules_go-v0.34.0.zip", "https://github.com/bazelbuild/rules_go/releases/download/v0.34.0/rules_go-v0.34.0.zip", ], ) load("@​io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies") go_rules_dependencies() go_register_toolchains(version = "1.18.4") </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, click this checkbox. --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/gapic-generator-go). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzMi4xMTcuNCIsInVwZGF0ZWRJblZlciI6IjMyLjExNy40In0=-->
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [io_bazel_rules_go](https://togithub.com/bazelbuild/rules_go) | http_archive | minor | `v0.33.0` -> `v0.34.0` | --- ### Release Notes <details> <summary>bazelbuild/rules_go</summary> ### [`v0.34.0`](https://togithub.com/bazelbuild/rules_go/releases/tag/v0.34.0) [Compare Source](https://togithub.com/bazelbuild/rules_go/compare/v0.33.0...v0.34.0) #### What's Changed - releaser: fix scrubbing timestamp from patch files by [@​sluongng](https://togithub.com/sluongng) in [https://github.com/bazelbuild/rules_go/pull/3180](https://togithub.com/bazelbuild/rules_go/pull/3180) - Replace Starlark JSON parser with json.decode by [@​fmeum](https://togithub.com/fmeum) in [https://github.com/bazelbuild/rules_go/pull/3184](https://togithub.com/bazelbuild/rules_go/pull/3184) - gopackagesdriver: separates "s" files in pkg info by [@​iamricard](https://togithub.com/iamricard) in [https://github.com/bazelbuild/rules_go/pull/3165](https://togithub.com/bazelbuild/rules_go/pull/3165) - Refactor away references to @​io_bazel_rules_go by [@​fmeum](https://togithub.com/fmeum) in [https://github.com/bazelbuild/rules_go/pull/3185](https://togithub.com/bazelbuild/rules_go/pull/3185) - Do not print to stderr if cgo linking succeeds after retry by [@​fmeum](https://togithub.com/fmeum) in [https://github.com/bazelbuild/rules_go/pull/3187](https://togithub.com/bazelbuild/rules_go/pull/3187) - Use param files with go-protoc by [@​fmeum](https://togithub.com/fmeum) in [https://github.com/bazelbuild/rules_go/pull/3190](https://togithub.com/bazelbuild/rules_go/pull/3190) - Don't include non-executable go_binary in dependent's runfiles by [@​fmeum](https://togithub.com/fmeum) in [https://github.com/bazelbuild/rules_go/pull/3151](https://togithub.com/bazelbuild/rules_go/pull/3151) - Link in native libraries of transitive dependencies in archive mode by [@​fmeum](https://togithub.com/fmeum) in [https://github.com/bazelbuild/rules_go/pull/3186](https://togithub.com/bazelbuild/rules_go/pull/3186) - runfiles: remove deprecated api by [@​sluongng](https://togithub.com/sluongng) in [https://github.com/bazelbuild/rules_go/pull/3198](https://togithub.com/bazelbuild/rules_go/pull/3198) - Fix failing open hermeticity test by [@​fmeum](https://togithub.com/fmeum) in [https://github.com/bazelbuild/rules_go/pull/3206](https://togithub.com/bazelbuild/rules_go/pull/3206) - Fix go_googleapis Gazelle patch by [@​nickgooding](https://togithub.com/nickgooding) in [https://github.com/bazelbuild/rules_go/pull/3193](https://togithub.com/bazelbuild/rules_go/pull/3193) - Exclude unsupported C/C++ features by [@​fmeum](https://togithub.com/fmeum) in [https://github.com/bazelbuild/rules_go/pull/3189](https://togithub.com/bazelbuild/rules_go/pull/3189) - Allow gomock to take Bazel common attributes by [@​linzhp](https://togithub.com/linzhp) in [https://github.com/bazelbuild/rules_go/pull/3207](https://togithub.com/bazelbuild/rules_go/pull/3207) - Transition on edges not self by [@​illicitonion](https://togithub.com/illicitonion) in [https://github.com/bazelbuild/rules_go/pull/3116](https://togithub.com/bazelbuild/rules_go/pull/3116) - Include go_transition_test in bazel aspect by [@​ian-h-chamberlain](https://togithub.com/ian-h-chamberlain) in [https://github.com/bazelbuild/rules_go/pull/3160](https://togithub.com/bazelbuild/rules_go/pull/3160) - Add an example for go_download_sdk.sdks by [@​fishy](https://togithub.com/fishy) in [https://github.com/bazelbuild/rules_go/pull/3139](https://togithub.com/bazelbuild/rules_go/pull/3139) - tests: nogo over generated code by [@​sluongng](https://togithub.com/sluongng) in [https://github.com/bazelbuild/rules_go/pull/3214](https://togithub.com/bazelbuild/rules_go/pull/3214) - test nogo/coverage: test generated code by [@​sluongng](https://togithub.com/sluongng) in [https://github.com/bazelbuild/rules_go/pull/3213](https://togithub.com/bazelbuild/rules_go/pull/3213) - Remove references to go_transition_test by [@​linzhp](https://togithub.com/linzhp) in [https://github.com/bazelbuild/rules_go/pull/3215](https://togithub.com/bazelbuild/rules_go/pull/3215) - Basic bzlmod setup by [@​fmeum](https://togithub.com/fmeum) in [https://github.com/bazelbuild/rules_go/pull/3047](https://togithub.com/bazelbuild/rules_go/pull/3047) - Run BCR tests against Bazel 6.0.0-pre.20220608.2 by [@​fmeum](https://togithub.com/fmeum) in [https://github.com/bazelbuild/rules_go/pull/3223](https://togithub.com/bazelbuild/rules_go/pull/3223) - Use repo-relative labels in MODULE.bazel by [@​fmeum](https://togithub.com/fmeum) in [https://github.com/bazelbuild/rules_go/pull/3226](https://togithub.com/bazelbuild/rules_go/pull/3226) - upkeep: upgrade to go 1.18.3 and gazelle v0.26.0 by [@​sluongng](https://togithub.com/sluongng) in [https://github.com/bazelbuild/rules_go/pull/3220](https://togithub.com/bazelbuild/rules_go/pull/3220) - nogo: ignore generated source files by [@​sluongng](https://togithub.com/sluongng) in [https://github.com/bazelbuild/rules_go/pull/3216](https://togithub.com/bazelbuild/rules_go/pull/3216) - asm: Pass package path with -p by [@​fmeum](https://togithub.com/fmeum) in [https://github.com/bazelbuild/rules_go/pull/3231](https://togithub.com/bazelbuild/rules_go/pull/3231) - bzlmod: Add support for gomock by [@​fmeum](https://togithub.com/fmeum) in [https://github.com/bazelbuild/rules_go/pull/3232](https://togithub.com/bazelbuild/rules_go/pull/3232) - test cgo: ensure helper script works by [@​sluongng](https://togithub.com/sluongng) in [https://github.com/bazelbuild/rules_go/pull/3236](https://togithub.com/bazelbuild/rules_go/pull/3236) - Fix //tests/legacy/examples/cgo:cgo_lib_test on M1 Macs by [@​fmeum](https://togithub.com/fmeum) in [https://github.com/bazelbuild/rules_go/pull/3237](https://togithub.com/bazelbuild/rules_go/pull/3237) - gopackagesdriver: Descend into go_proto_compiler's deps by [@​fmeum](https://togithub.com/fmeum) in [https://github.com/bazelbuild/rules_go/pull/3240](https://togithub.com/bazelbuild/rules_go/pull/3240) - new_library: remove unused resolver by [@​sluongng](https://togithub.com/sluongng) in [https://github.com/bazelbuild/rules_go/pull/3219](https://togithub.com/bazelbuild/rules_go/pull/3219) - nogo: instantiate type info for generic types when running under Go >=1.18 by [@​farhaven](https://togithub.com/farhaven) in [https://github.com/bazelbuild/rules_go/pull/3212](https://togithub.com/bazelbuild/rules_go/pull/3212) #### New Contributors - [@​iamricard](https://togithub.com/iamricard) made their first contribution in [https://github.com/bazelbuild/rules_go/pull/3165](https://togithub.com/bazelbuild/rules_go/pull/3165) - [@​ian-h-chamberlain](https://togithub.com/ian-h-chamberlain) made their first contribution in [https://github.com/bazelbuild/rules_go/pull/3160](https://togithub.com/bazelbuild/rules_go/pull/3160) - [@​fishy](https://togithub.com/fishy) made their first contribution in [https://github.com/bazelbuild/rules_go/pull/3139](https://togithub.com/bazelbuild/rules_go/pull/3139) - [@​farhaven](https://togithub.com/farhaven) made their first contribution in [https://github.com/bazelbuild/rules_go/pull/3212](https://togithub.com/bazelbuild/rules_go/pull/3212) **Full Changelog**: bazel-contrib/rules_go@v0.33.0...v0.34.0 #### `WORKSPACE` code load("@​bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") http_archive( name = "io_bazel_rules_go", sha256 = "16e9fca53ed6bd4ff4ad76facc9b7b651a89db1689a2877d6fd7b82aa824e366", urls = [ "https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.34.0/rules_go-v0.34.0.zip", "https://github.com/bazelbuild/rules_go/releases/download/v0.34.0/rules_go-v0.34.0.zip", ], ) load("@​io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies") go_rules_dependencies() go_register_toolchains(version = "1.18.4") </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, click this checkbox. --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/gapic-config-validator). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzMi4xMTcuNCIsInVwZGF0ZWRJblZlciI6IjMyLjExNy40In0=-->
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.
Replacement of #2996
Fixes #2984