Commit bc32353
fix(gazelle): generate target names from proto file name, not directory
Fix target name generation in the buf gazelle plugin's `CrossResolve` function
to use the proto file name instead of the directory name. This aligns with the
official Bazel proto_library naming convention documented at:
https://bazel.build/reference/be/protocol-buffer
Per Bazel's convention: "A file named foo.proto will be in a rule named
foo_proto, which is located in the same package."
The original code used `proto.RuleName(path.Dir(importSpec.Imp))` which
incorrectly derived target names from the directory path.
Example import: `logical/interface.proto`
Before (wrong): `@buf_deps//logical:logical_proto` (from directory)
After (correct): `@buf_deps//logical:interface_proto` (from file)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>1 parent 7b3b1f0 commit bc32353
1 file changed
+8
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
22 | | - | |
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
49 | 55 | | |
50 | 56 | | |
51 | | - | |
| 57 | + | |
52 | 58 | | |
53 | 59 | | |
54 | 60 | | |
0 commit comments