bazel-contrib / bazel-contrib/rules_go
go_proto_library: default "compiler" misinterprets importpath value with semicolon package name suffix
- 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?
`v0.33.0`
### What version of gazelle are you using?
`v0.24.0`
### What version of Bazel are you using?
`v5.2.0`
### Does this issue reproduce with the latest releases of all the above?
Yes.
### What operating system and processor architecture are you using?
Linux, AMD64
### Any other potentially useful information about your toolchain?
Using the default "compiler" for go_proto_library, not using a custom `go_proto_compiler` target for custom generation options. I realize that is another approach to take, but wondered if the below was an issue or not.
### What did you do?
Supplied a `path;package` format value to the `importpath` attribute of a `go_proto_library` target. For example, `google.golang.org/genproto/googleapis/cloud/secretmanager/v1;secretmanagerpb`
### What did you expect to see?
The generated code in bazel output with directory name `google.golang.org/genproto/googleapis/cloud/secretmanager/v1`.
### What did you see instead?
The generated code in bazel output with directory name `google.golang.org/genproto/googleapis/cloud/secretmanager/v1;secretmanagerpb`.
The goal was to see if we could override the importpath and package name with go_proto_library targets. The generated package name is properly updated, but the resulting directory structure of the generated code incorrectly includes the `;package` section of the value.
I'm not sure if using `path;package` syntax is actually allowed with `importpath`. If it isn't, perhaps lets throw an error? If it is, perhaps we should fix the generated directory structure to trim the `;package` suffix.
Contributor guide
Research direction
Start at the go_proto_library importpath handling and the default compiler, using the reported path;package example and the stated rules_go, Gazelle, and Bazel versions to reproduce the output directory. Determine whether the suffix is supported; done means either a clear validation error for unsupported syntax or generated code under the path without the package suffix.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100