bazel-contrib / bazel-contrib/rules_go

Provide instructions or a feature to vendor/copy generated stubs to the source tree

Open
#3,658 5 comments 1 reaction 0 assignees View on GitHub
Dominant language
Go
Stars
1.5k
Forks
762
Avg merge
1d 11h
Merged PRs (30d)
12

Description

`go_proto_library` produces some `.pb.go` stub files. These are then immediately compiled, such that the default output of the rule is a `.a` file.

However, editors and other code analysis tools expect to be able to find these files. It's possible to teach these tools an alternative lookup mechanism, like with GoPackagesDriver, but this is pretty difficult and has to be done for each tool.

The other answer is to write these files to the source tree. `bazel build` by itself can't do this, but there are several patterns in the Bazel ecosystem which can be followed, for example https://github.com/stackb/rules_proto#proto_compiled_sources

Ideally I'd like an attribute to `go_proto_library` that ensures the `.pb.go` files are next to the `.proto` files and are up-to-date.

Contributor guide

Open the contributing guide

Research direction

Start with the go_proto_library rule and the generated .pb.go outputs described in the issue, then review the referenced rules_proto pattern for proto_compiled_sources. Done means providing instructions or an attribute that places generated .pb.go files next to their .proto files and keeps them up to date.

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.