Skip to content

protoc-gen-elixir will crash when indent with 4 space #280

@wingyplus

Description

@wingyplus

From https://github.com/wingyplus/grpc/blob/main/test/support/helloworld.proto. If I change message field by diff below:

diff --git a/test/support/helloworld.proto b/test/support/helloworld.proto
index 0436df6..9bf602a 100644
--- a/test/support/helloworld.proto
+++ b/test/support/helloworld.proto
@@ -11,7 +11,7 @@ service Greeter {

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

 // The response message containing the greetings

The protoc-gen-elixir will crash with output:

** (MatchError) no match of right hand side value: "st"
    (protobuf 0.10.0) lib/protobuf/decoder.ex:70: Protobuf.Decoder.handle_field/5
    (protobuf 0.10.0) lib/protobuf/decoder.ex:17: Protobuf.Decoder.decode/2
    (protobuf 0.10.0) lib/protobuf/decoder.ex:231: Protobuf.Decoder.value_for_field/3
    (protobuf 0.10.0) lib/protobuf/decoder.ex:382: Protobuf.Decoder.update_in_message/3
    (protobuf 0.10.0) lib/protobuf/decoder.ex:176: Protobuf.Decoder.handle_value/6
    (protobuf 0.10.0) lib/protobuf/decoder.ex:17: Protobuf.Decoder.decode/2
    (protobuf 0.10.0) lib/protobuf/decoder.ex:231: Protobuf.Decoder.value_for_field/3
    (protobuf 0.10.0) lib/protobuf/decoder.ex:382: Protobuf.Decoder.update_in_message/3
--elixir_out: protoc-gen-elixir: Plugin failed with status code 1.

I run it on Windows 11 with PowerShell Core.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Kind:BugA bug. Can be a documentation bug, Dialyzer issue, or anything that just "doesn't work".Platform:WindowsWindows-related issues.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions