Skip to content

Bug using Bazel rules: google/protobuf/go_features.proto: File not found. #1679

Closed
@cshabsin

Description

@cshabsin

What version of protobuf and what language are you using?
29.3, I think (see below re: Bazel rules)

What did you do?
I attempted to build a simple go "hello world" with opaque API protos (declared in the .proto file via go_features.proto-provided extension).

MODULE.bazel:

bazel_dep(name = "protobuf", version = "29.3")
bazel_dep(name = "rules_go", version = "0.50.1")

BUILD.bazel:

load("@rules_go//go:def.bzl", "go_binary")
load("@rules_go//proto:def.bzl", "go_proto_library")

go_binary(
    name = "hello",
    srcs = ["hello.go"],
    deps = [":dumbdata_go_proto"],
)

proto_library(
    name = "dumbdata_proto", 
    srcs = ["dumb_data.proto"],
)

go_proto_library(
    name = "dumbdata_go_proto", 
    protos = [":dumbdata_proto"],
    importpath = "github.com/cshabsin/nih/dumbdata_go_proto",
)

dumb_data.proto:

edition = "2023";

package dumbdata;

import "google/protobuf/go_features.proto";
option features.(pb.go).api_level = API_OPAQUE;

// The DumbData message definition
message Item {
    int32 id = 1;
    string name = 2;
    bool is_active = 3;
}

What did you expect to see?

I expected to be able to access the protobuf opaque API.

What did you see instead?

bazel build :dumbdata_go_proto output:

google/protobuf/go_features.proto: File not found.
dumb_data.proto:5:1: Import "google/protobuf/go_features.proto" was not found or had errors.

Anything else we should know about your project / environment?

It looks like rules_go depends on a rather old version of protobuf? I was hoping I could override it by importing a newer version first, but I guess it makes sense that that didn't work. Can this be updated?

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions