Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

【need_help】def generate(%Protobuf.Protoc.Context{} = ctx, %Google.Protobuf.FileDescriptorProto{} = desc, plugins) #5

Open
openmindw opened this issue Jun 10, 2024 · 2 comments

Comments

@openmindw
Copy link

env:
Erlang/OTP 26 [erts-14.2.5] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [jit:ns]

Mix 1.16.3 (compiled with Erlang/OTP 24)

wsl2-arch


when i use the commad: mix protobuf.generate --output-path=./lib --include-path=./priv/protos helloworld.proto it will report:

`

mix protobuf.generate --output-path=./lib --include-path=./priv/protos helloworld.proto

==> protobuf_generate
Compiling 9 files (.ex)
Generated protobuf_generate app
==> elixir_grpc
Generated elixir_grpc app
** (FunctionClauseError) no function clause matching in ProtobufGenerate.CodeGen.generate/3

The following arguments were given to ProtobufGenerate.CodeGen.generate/3:

    # 1
    %Protobuf.Protoc.Context{plugins: [], global_type_mapping: %{"helloworld.proto" => %{".helloworld.HelloReply" => %{type_name: "Helloworld.HelloReply"}, ".helloworld.HelloRequest" => %{type_name: "Helloworld.HelloRequest"}}}, package: nil, package_prefix: nil, module_prefix: nil, syntax: nil, dep_type_mapping: %{}, namespace: [], gen_descriptors?: false, transform_module: nil, one_file_per_module?: false, include_docs?: false, custom_file_options: %{}}

    # 2
    nil

    # 3
    [ProtobufGenerate.Plugins.Enum, ProtobufGenerate.Plugins.Extension, ProtobufGenerate.Plugins.Message]

Attempted function clauses (showing 1 out of 1):

    def generate(%Protobuf.Protoc.Context{} = ctx, %Google.Protobuf.FileDescriptorProto{} = desc, plugins)

(protobuf_generate 0.1.2) lib/protobuf_generate/code_gen.ex:8: ProtobufGenerate.CodeGen.generate/3
(elixir 1.16.3) lib/enum.ex:4326: Enum.flat_map_list/2
(protobuf_generate 0.1.2) lib/mix/protobuf.generate.ex:124: Mix.Tasks.Protobuf.Generate.generate/2
(protobuf_generate 0.1.2) lib/mix/protobuf.generate.ex:86: Mix.Tasks.Protobuf.Generate.run/1
(mix 1.16.3) lib/mix/task.ex:478: anonymous fn/3 in Mix.Task.run_task/5
(mix 1.16.3) lib/mix/cli.ex:96: Mix.CLI.run_task/2
/root/.local/share/mise/installs/elixir/1.16.3/bin/mix:2: (file)

`

the helloword file code:
`
syntax = "proto3";

package helloworld;

// The request message containing the user's name.
message HelloRequest {
string name = 1;
}

// The response message containing the greeting
message HelloReply {
string message = 1;
}

// The greeting service definition.
service Greeter {
// Greeting function
rpc SayHello (HelloRequest) returns (HelloReply) {}
}

`

@openmindw
Copy link
Author

"protobuf_generate": {:hex, :protobuf_generate, "0.1.2", "45b9a9ae8606333cdea993ceaaecd799d206cdfe23348d37c06207eac76cbee6", [:mix], [{:protobuf, "~> 0.12", [hex: :protobuf, repo: "hexpm", optional: false]}], "hexpm", "55b0ff8385703317ca90e1bd30a2ece99e80ae0c73e6ebcfb374e84e57870d61"},

@drowzy
Copy link
Owner

drowzy commented Jun 10, 2024

Try: mix protobuf.generate --output-path=./lib --include-path=./priv/protos./priv/protos/test.proto

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants