bazel-contrib / bazel-contrib/rules_go

file '@io_bazel_rules_go//proto:def.bzl' does not contain symbol 'go_proto_compiler'

Open
#3,229 4 comments 0 reactions 0 assignees View on GitHub
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?
0.32.0

### What version of gazelle are you using?
0.25.0

### What version of Bazel are you using?
Build label: 5.2.0

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

### What operating system and processor architecture are you using?
macOS Monterey v12.0.1
1.4 GHz Quad-Core Intel Core i5

### What did you do?
Tried to build a gRPC target using `go_proto_compiler`. See BUILD:

```
load("@io_bazel_rules_go//go:def.bzl", "go_library")
load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library", "go_proto_compiler")

package(default_visibility = ["//visibility:public"])

load("@rules_proto//proto:defs.bzl", "proto_library")
load("@com_github_grpc_grpc//bazel:cc_grpc_library.bzl", "cc_grpc_library")
load("@com_github_grpc_grpc//bazel:grpc_build_system.bzl", "grpc_proto_library")
load("@com_github_grpc_grpc//bazel:python_rules.bzl", "py_grpc_library", "py_proto_library")

proto_library(
name = "processor_proto",
srcs = ["Processor.proto"],
deps = ["//services/shared/proto/common:common_proto"],
)

cc_proto_library(
name = "processor_cc_proto",
deps = [":processor_proto"],
)

cc_grpc_library(
name = "processor_cc_grpc",
srcs = [":processor_proto"],
grpc_only = True,
deps = [":processor_cc_proto"],
)

go_proto_library(
name = "processor_go_proto",
compilers = [":compiler"],
importpath = "github.com/vymao/Anthem/back-end/main/services/shared/proto/processor",
proto = ":processor_proto",
deps = ["//services/shared/proto/common"],
)

go_library(
name = "processor",
embed = [":processor_go_proto"],
importpath = "github.com/vymao/Anthem/back-end/main/services/shared/proto/processor",
)

go_proto_compiler(
name = "compiler",
plugin = "@io_bazel_rules_go//proto:go_grpc",
options = [
"go_out=/services/shared/proto/processor"
]
) = "/main/services/shared/proto/processor",
proto = ":processor_proto",
deps = ["//services/shared/proto/common"],
)

go_library(
name = "processor",
embed = [":processor_go_proto"],
importpath = "/main/services/shared/proto/processor",
)

go_proto_compiler(
name = "compiler",
plugin = "@io_bazel_rules_go//proto:go_grpc",
options = [
"go_out=/services/shared/proto/processor"
]
)
```
### What did you expect to see?
A successful BUILD

### What did you see instead?
Bazel gives an error saying
```
ERROR: Traceback (most recent call last):
File "/path/to/main/services/shared/proto/processor/BUILD", line 2, column 44, in
load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library", "go_proto_compiler")
Error: file '@io_bazel_rules_go//proto:def.bzl' does not contain symbol 'go_proto_compiler'
```
Seems rather strange. I tried using the latest version of Bazel and it still does not work.

Contributor guide

Open the contributing guide

Research direction

Start with the services/shared/proto/processor/BUILD file, especially the load from @io_bazel_rules_go//proto:def.bzl and the go_proto_compiler references. Re-run the reported Bazel build and compare those symbols with the rules_go 0.32.0 setup. Done means the BUILD file loads successfully and the gRPC target builds.

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
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.