bazel-contrib / bazel-contrib/rules_go

Trouble passing plugin flags to protoc via go_proto_compiler

Open
#2,709 8 comments 0 reactions 0 assignees View on GitHub
question
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?

v0.24.3

### What version of gazelle are you using?

v0.22.2

### What version of Bazel are you using?

Build label: 3.5.1-homebrew
Build target: bazel-out/darwin-opt/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar
Build time: Thu Oct 1 17:34:08 2020 (1601573648)
Build timestamp: 1601573648
Build timestamp as int: 1601573648

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

yes

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

macOS x86

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

### What did you do?

Attempting to use a protoc plugin like so:

```
go_proto_compiler(
name = "struct_transformer",
options = [
"struct-transformer_out=package=transform,helper-package=helpers:.",
"go_out=Moptions/annotations.proto=github.com/ZacxDev/protoc-gen-struct-transformer/options",
],
plugin = "@com_github_ZacxDev_protoc_gen_struct_transformer//:protoc-gen-struct-transformer",
suffix = ".transformer.pb.go",
)
```

### What did you expect to see?

successful build with transformer functions generated

### What did you see instead?

```
2020/11/09 16:11:37 no such flag -struct-transformer_out
--struct-transformer_out: protoc-gen-struct-transformer: Plugin failed with status code 1.
```

Sorry if this is a simple case of user error, I am very new to Bazel. I have been stuck on this for about a week now and am getting close to giving up, this issue is my only hope!

I've tried playing around with different flag formats but nothing seems to take. I really just need to pass these options as flags to `protoc`, from what I've read go_proto_compiler/options is the right place but I really am not sure.

Thanks for any help <3

Contributor guide

Open the contributing guide

Research direction

Start at the go_proto_compiler entry point and reproduce the reported build with the shown plugin and options. Compare the accepted option format with the failing protoc invocation; done means the build succeeds and transformer functions are generated without the no-such-flag error.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
build-system, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.