gogo / letmegrpc

[maintainer wanted] generates a web form gui from a grpc specification

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Package name with dots in it causes failure

utrack opened this issue · comments

» letmegrpc --addr=localhost:65021 --port=8080 -proto_path ~/go/src/content_api/domains/border/category ~/go/src/content_api/domains/border/category/category.proto

2016/09/05 19:03:53 panic: runtime error: index out of range

goroutine 1 [running]:
panic(0x55e280, 0xc42000a180)
        /usr/lib/go/src/runtime/panic.go:500 +0x1a1
github.com/gogo/letmegrpc/html.(*html).generateFormFunc(0xc4200f3570, 0xc4200efd82, 0xe, 0xc4200134a0)
        /home/u/go/src/github.com/gogo/letmegrpc/html/html.go:93 +0x4e1
github.com/gogo/letmegrpc/html.(*html).Generate(0xc4200f3570, 0xc4200da1b0)
        /home/u/go/src/github.com/gogo/letmegrpc/html/html.go:169 +0x2dce
github.com/gogo/protobuf/protoc-gen-gogo/generator.(*Generator).generatePlugin(0xc42009e000, 0xc4200da1b0, 0x63c7e0, 0xc4200f3570)
        /home/u/go/src/github.com/gogo/protobuf/protoc-gen-gogo/generator/helper.go:330 +0x142
github.com/gogo/protobuf/protoc-gen-gogo/generator.(*Generator).GeneratePlugin(0xc42009e000, 0x63c7e0, 0xc4200f3570)
        /home/u/go/src/github.com/gogo/protobuf/protoc-gen-gogo/generator/helper.go:309 +0x22d
main.main()
        /home/u/go/src/github.com/gogo/letmegrpc/protoc-gen-letmegrpc/main.go:59 +0x32e
--letmegrpc_out: protoc-gen-letmegrpc: Plugin failed with status code 2.
 exit status 1

Seems like it happens if package name has dots in it.

Good to know.
Interested in contributing a fix?

@awalterschulze Yeap, I'll look into it.

That will be great thanks.
Just be warned this is some of the worst code I have ever written.
Unfortunately it works quite well.

There is a different failure right now.

Assume this command:

protoc --letmegrpc_out=. -I. tmp.proto

Building this file works:

# tmp.proto
syntax = "proto3";
package com;
message Blah {
};
service Asd {
  rpc Foo(Blah) returns (Blah);
}

Building this file does not:

# tmp.proto
syntax = "proto3";
package com.example;
message Blah {
};
service Asd {
  rpc Foo(Blah) returns (Blah);
}

Error produced:

2017/02/23 00:21:24 protoc-gen-gogo: error:can't find object with type .com.example
--letmegrpc_out: protoc-gen-letmegrpc: Plugin failed with status code 1.

Error still talks about com.example even if I change the package name to com.example.project.

That much is obvious both from my report and this bug's title, no? 😂

Finally got some time.
Fixed
2d46be8