bazel-contrib / bazel-contrib/rules_go

Circular dependency with protobuf

Open
#4,196 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
1.5k
Forks
760
Avg merge
1d 11h
Merged PRs (30d)
12

Description

### What version of rules_go are you using?

0.51.0

### What version of gazelle are you using?

0.40.0

### What version of Bazel are you using?

8.0

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

Yes

### What operating system and processor architecture are you using?

Linux

### Any other potentially useful information about your toolchain?

I found this in https://github.com/bazelbuild/bazel-central-registry/pull/3414/files ([logs]()https://buildkite.com/bazel/bcr-presubmit/builds/9387#0193c668-67e2-4bf9-ad25-ac0ca0d40321) but also stumbled over this in our internal workspace for other dependencies where we use the latest version of Bazel deps (go.mod might be a little bit older).

### What did you do?

Use Gazelle to build go.mod dependencies.

### What did you expect to see?

Working just fine.

### What did you see instead?

```
(18:25:05) ERROR: /var/lib/buildkite-agent/.cache/bazel/_bazel_buildkite-agent/5bf8f7e7e7bb5e412d42f707ae65b6b9/external/rules_go+/proto/BUILD.bazel:24:18: in _go_proto_compiler rule @@rules_go+//proto:go_proto: cycle in dependency graph:
@@protoc-gen-validate+//bazel/go:pgv_plugin_go (48c0a821cf0ed18ef2cbc1ea1d4a740d63398d359260dd0e0d15ea5340fb561e)
@@protoc-gen-validate+//bazel/go:pgv_plugin_go (6042ca88946d439c676f8f6934f1607d03dd673e4afcca85f0ca449072a5f1db)
@@protoc-gen-validate+//bazel/go:pgv_plugin_go_reset_plugin_ (ca5463bbfab481435841d997e799fc56f9e2d61c061c1694867c0133c2dd0e8a)
@@protoc-gen-validate+//:protoc-gen-validate (dc2b93f47f15dcd32b7df9eaa6e969f0abf6a08d6340f3631337d326c9bcde5c)
@@protoc-gen-validate+//:protoc-gen-validate_lib (dc2b93f47f15dcd32b7df9eaa6e969f0abf6a08d6340f3631337d326c9bcde5c)
@@protoc-gen-validate+//module:module (dc2b93f47f15dcd32b7df9eaa6e969f0abf6a08d6340f3631337d326c9bcde5c)
@@protoc-gen-validate+//validate:validate_go (dc2b93f47f15dcd32b7df9eaa6e969f0abf6a08d6340f3631337d326c9bcde5c)
@@protoc-gen-validate+//validate:validate_go_proto (dc2b93f47f15dcd32b7df9eaa6e969f0abf6a08d6340f3631337d326c9bcde5c)
.-> @@rules_go+//proto:go_proto (dc2b93f47f15dcd32b7df9eaa6e969f0abf6a08d6340f3631337d326c9bcde5c)
| @@rules_go+//proto:go_proto_reset_plugin_ (dc2b93f47f15dcd32b7df9eaa6e969f0abf6a08d6340f3631337d326c9bcde5c)
| @@gazelle++go_deps+com_github_golang_protobuf//protoc-gen-go:protoc-gen-go (dc2b93f47f15dcd32b7df9eaa6e969f0abf6a08d6340f3631337d326c9bcde5c)
| @@gazelle++go_deps+com_github_golang_protobuf//protoc-gen-go:protoc-gen-go_lib (dc2b93f47f15dcd32b7df9eaa6e969f0abf6a08d6340f3631337d326c9bcde5c)
| @@gazelle++go_deps+org_golang_google_protobuf//compiler/protogen:protogen (dc2b93f47f15dcd32b7df9eaa6e969f0abf6a08d6340f3631337d326c9bcde5c)
| @@gazelle++go_deps+org_golang_google_protobuf//reflect/protodesc:protodesc (dc2b93f47f15dcd32b7df9eaa6e969f0abf6a08d6340f3631337d326c9bcde5c)
| @@gazelle++go_deps+org_golang_google_protobuf//src/google/protobuf:gofeaturespb (dc2b93f47f15dcd32b7df9eaa6e969f0abf6a08d6340f3631337d326c9bcde5c)
| @@gazelle++go_deps+org_golang_google_protobuf//src/google/protobuf:gofeaturespb_go_proto (dc2b93f47f15dcd32b7df9eaa6e969f0abf6a08d6340f3631337d326c9bcde5c)
`-- @@rules_go+//proto:go_proto (dc2b93f47f15dcd32b7df9eaa6e969f0abf6a08d6340f3631337d326c9bcde5c)
```

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the Gazelle go.mod dependency generation with rules_go 0.51.0, Gazelle 0.40.0, and Bazel 8.0, then inspect external/rules_go+/proto/BUILD.bazel at line 24 and the dependency cycle in the reported targets. Compare the bazel-central-registry PR 3414 files and linked Buildkite log; done means the protobuf dependencies build without a cycle.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.