protoc-gen-validate icon indicating copy to clipboard operation
protoc-gen-validate copied to clipboard

Trying to generate `*.pb.validate.go` files using Bazel and Gazelle

Open AFMiziara opened this issue 1 year ago • 3 comments

So I have loaded protoc-gen-validate in my WORKSPACE, like that:

# Load protoc-gen-validate plugin used within protobuf files.
http_archive(
    name = "com_envoyproxy_protoc_gen_validate",  # 2023-03-20
    sha256 = "884f7166893d4869d9e86c171777c11e51b138a6ec170e1d8eba8f091a9ef85a",
    strip_prefix = "protoc-gen-validate-0.10.1",
    urls = [
        "https://github.com/bufbuild/protoc-gen-validate/archive/refs/tags/v0.10.1.tar.gz",
    ],
)

load("@com_envoyproxy_protoc_gen_validate//bazel:repositories.bzl", "pgv_dependencies")

pgv_dependencies()

And I added this gazelle directive, as suggested here:

# gazelle:go_proto_compilers @com_envoyproxy_protoc_gen_validate//bazel/go:pgv_plugin_go, @io_bazel_rules_go//proto:go_proto
gazelle(
    name = "gazelle",
    gazelle = "//:gazelle_binary",
)

When I try to bazel build //... I got this error:

compilepkg: missing strict dependencies:
	/private/var/tmp/_bazel_xxx/f7366cb40f218cae24698ffbd08f4bf3/sandbox/darwin-sandbox/2751/execroot/io_xxx_go/external/com_envoyproxy_protoc_gen_validate/templates/shared/context.go: import of "github.com/lyft/protoc-gen-star/v2"

What am I missing here? Looks like bazel is not loading some go dependencies from protoc-gen-validate.

AFMiziara avatar Apr 06 '23 22:04 AFMiziara

I have updated protoc-gen-validate and now I am facing the same issue as https://github.com/bufbuild/protoc-gen-validate/issues/535

AFMiziara avatar Apr 11 '23 00:04 AFMiziara

@AFMiziara FYI should be fixed in https://github.com/bufbuild/protoc-gen-validate/releases/tag/v1.0.2

alexbozhenko avatar Jun 26 '23 22:06 alexbozhenko

Thank you for the heads up @alexbozhenko

AFMiziara avatar Jun 27 '23 21:06 AFMiziara

Hello, thanks for your interest! As explained in the README, this project is in maintenance mode. We recommend upgrading to protovalidate.

I'm going to go ahead and close this issue, but feel free to open one against protovalidate if needed. Thanks!

chrispine avatar Feb 29 '24 19:02 chrispine