bazel-contrib / bazel-contrib/rules_go
Remove `deps` attribute from `go_proto_library` by automatically inferring them
- Dominant language
- Go
- Stars
- 1.5k
- Forks
- 762
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 12
Description
### What version of rules_go are you using?
0.37.0
### What version of gazelle are you using?
0.31.0
### What version of Bazel are you using?
6.2.0
### Does this issue reproduce with the latest releases of all the above?
Checking the release notes, the requested feature is not there yet
### What operating system and processor architecture are you using?
NA
### Any other potentially useful information about your toolchain?
NA
### What did you do?
I wrote a `go_proto_library` rule for a corresponding `proto_library` rule.
For example,
```
proto_library(
name = "foo_proto",
deps = [":bar_proto"],
)
go_proto_library(
name = "foo_go_proto",
protos = [":foo_proto"],
deps = [":bar_go_proto"],
)
```
### What did you expect to see?
The `deps` attribute needs the corresponding `bar_go_proto` to be included. Since the `protos` attribute has the corresponding proto rules, it would be nice to see the `bar_go_proto` to be inferred by the rule automatically. In other words, we'd like to see the `deps` attribute removed altogether in the `go_proto_library` rule. This is how it works in blaze, and it is implemented using `aspects` there.
`cc_proto_library` from `rules_cc` and `py_proto_library` from `rules_python` already does this too.
Expected:
```
proto_library(
name = "foo_proto",
deps = [":bar_proto"],
)
go_proto_library(
name = "foo_go_proto",
protos = [":foo_proto"],
)
```
### What did you see instead?
This feature is not part of the releases yet. I can also support in developing this but I'm not sure about the work needed and where.
Contributor guide
Research direction
Start with the go_proto_library rule and compare how cc_proto_library and py_proto_library infer dependencies. Read the aspect-based approach mentioned in the issue, then determine how protos should supply corresponding Go dependencies. Done means the expected example works without a deps attribute on go_proto_library.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- build-system
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100