bazel
bazel copied to clipboard
genquery + transitions: build error when query succeeds
Description of the problem / feature request:
Using Bazel 4.2.0, a genquery
expression fails when the corresponding bazel query
succeeds, apparently due to not handling an important transition used by rules_go to implement the "nogo" static analysis tool.
Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
To reproduce:
git clone [email protected]:robfig/rules_go-issue2991.git
cd rules_go-issue2991
bazel build //:foo_go_proto # works
bazel query "kind('proto_library', deps(//:foo_go_proto))" # works
bazel build //:deps # fails
The error message:
ERROR: /private/var/tmp/_bazel_robfig/cf4a500e949de5c5d412d75252cf434f/external/io_bazel_rules_go/BUILD.bazel:73:16: in go_context_data rule @io_bazel_rules_go//:go_context_data: cycle in dependency graph:
//:deps
//:foo_go_proto
@io_bazel_rules_go//proto:go_proto
@org_golang_google_protobuf//types/known/structpb:structpb
@org_golang_google_protobuf//reflect/protoreflect:protoreflect
@org_golang_google_protobuf//encoding/protowire:protowire
@org_golang_google_protobuf//internal/errors:errors
@org_golang_google_protobuf//internal/detrand:detrand
.-> @io_bazel_rules_go//:go_context_data
| @io_bazel_rules_nogo//:nogo
| //:default_nogo
| //:default_nogo_actual
| @io_bazel_rules_go//go/tools/builders:nogo_srcs
| @org_golang_x_tools//go/gcexportdata:gcexportdata
| @org_golang_x_tools//go/internal/gcimporter:gcimporter
`-- @io_bazel_rules_go//:go_context_data
ERROR: Analysis of target '//:deps' failed; build aborted
This was discovered after rules_go moved to transitions for static analysis support in this commit: https://github.com/bazelbuild/rules_go/commit/63dfd99403076331fef0775d52a8039d502d4115
I don't see any way to fix it within rules_go.
What operating system are you running Bazel on?
MacOS Catalina
What's the output of bazel info release
?
release 4.2.0
Have you found anything relevant by searching the web?
I found no relevant results for the terms: genquery transitions